import css from "./styles.css" with { type: "text" }; import pds from "./pds/pds.ts"; import knot from "./knot/knot.ts"; const PORT = Number(Deno.env.get("PORT")); Deno.serve( { port: !Number.isNaN(PORT) && PORT <= 65535 && PORT > 0 ? PORT : 8000 }, (req) => { const path = new URL(req.url).pathname; console.log("PATH", path); switch (path) { case "/styles.css": return new Response(css, { headers: { "Content-Type": "text/css; charset=utf-8", "Access-Control-Allow-Origin": "*", }, }); case "/pds": case "/pds/": return pds(); case "/knot": case "/knot/": return knot(); } console.warn(`Request for ${path} returned 404`); return new Response("404 Not Found", { status: 404, statusText: "Not Found", }); } );