-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocumentation.ts
31 lines (28 loc) · 1.03 KB
/
documentation.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { CreateProxyOptions } from "./types.ts";
export const documentation =
({ account, containers, suffix, handlers }: CreateProxyOptions) =>
(_request: Request): Response => {
const methods = new Set(handlers.keys());
const methodsList = [...methods].map((m) => `\n<li>${m}</li>`).join("");
const containerList = [...containers].map((c) =>
`\n<li><a href="/${c}?list">${c}</a></li>`
).join("");
return new Response(
`<!DOCTYPE html><html lang="en">
<head><meta name="viewport" content="width=device-width, initial-scale=1"></head>
<body><h1>azure_blob_proxy</h1>
<dl>
<dt>Account</dt>
<dd>${account}</dd>
<dt>Suffix</dt>
<dd>${suffix}</dd>
<dt>Methods</dt>
<dd><ul>${methodsList}</ul></dd>
<dt>Containers</dt>
<dd><dd><ul>${containerList}</ul></dd>
</dl>
<footer><a href="https://github.com/akvaplan-niva/azure_blob_proxy">azure_blob_proxy</a> is open source on Akvaplan-niva's GitHub.</footer>
</body></html>`,
{ headers: { "content-type": "text/html; charset=utf-8" } },
);
};