OverviewFilesCommitsIssuesDocsReleasesPeers

ANProto commits / ddc040c

fmt
ddc040ca2d4218ffea9a531202ed21efcb3abfb7
by Everett Bogue <ev@evbogue.com> · 2025-09-30T16:20:01.000Z

Changed files (1) +23 -21

serve.js +23 -21
……@@ -1,28 +1,27 @@
11import { Hono } from "jsr:@hono/hono";
2import { serveStatic } from 'jsr:@hono/hono/deno'
3import { marked } from 'https://esm.sh/gh/evbogue/bog5@de70376265/lib/marked.esm.js'
2import { serveStatic } from "jsr:@hono/hono/deno";
3import { marked } from "https://esm.sh/gh/evbogue/bog5@de70376265/lib/marked.esm.js";
44
55import { foot, head } from "./template.js";
66
77const app = new Hono();
88
9const readme = await Deno.readTextFile('./README.md')
9const readme = await Deno.readTextFile("./README.md");
1010
11app.get('/', async (c) => {
11app.get("/", async (c) => {
1212 const content = `
1313 <div id="scroller">
1414 <div class='message'>
1515 ${await marked(readme)}
1616 </div>
1717 </div>
18 `
18 `;
1919
20 const html = await head('Index') + content + await foot()
21 return await c.html(html)
22})
23
24app.get('/try', async (c) => {
20 const html = await head("Index") + content + await foot();
21 return await c.html(html);
22});
2523
24app.get("/try", async (c) => {
2625 const body = `<body>
2726 <div id='scroller'>
2827 <div class='message'>
……@@ -136,17 +135,20 @@ getbutton.onclick = async () => {
136135 }
137136}
138137
139</script>`
138</script>`;
140139
141 const html = await head('Try it') + body + await foot()
142 return await c.html(html)
143})
140 const html = await head("Try it") + body + await foot();
141 return await c.html(html);
142});
144143
145app.use('*', serveStatic({
146 root: './',
147 onFound: (_path, c) => {
148 c.header("Access-Control-Allow-Origin", "*")
149 }
150 }))
144app.use(
145 "*",
146 serveStatic({
147 root: "./",
148 onFound: (_path, c) => {
149 c.header("Access-Control-Allow-Origin", "*");
150 },
151 }),
152);
151153
152export default app
154export default app;