import { createApp } from "https://deno.land/x/servest@v1.3.1/mod.ts"; const html = await (await fetch(new URL("index.html", import.meta.url))).text(); const js = await (await fetch(new URL("index.js", import.meta.url))).text(); const app = createApp(); app.handle("/", async (req) => { await req.respond({ status: 200, headers: new Headers({ "content-type": "text/html; charset=UTF-8", "Content-Security-Policy": "script-src 'self' unpkg.com 'unsafe-eval'", }), body: html, }); }); app.handle("/index.js", async (req) => { await req.respond({ status: 200, headers: new Headers({ "content-type": "application/javascript; charset=UTF-8", "Content-Security-Policy": "connect-src scrapbox.io;", }), body: js, }); }); const port = 8899; app.listen({ port }); console.log(`open http://localhost:${port}`);