this repo has no description
1import css from "./styles.css" with { type: "text" };
2import pds from "./pds/pds.ts";
3import knot from "./knot/knot.ts";
4
5const PORT = Number(Deno.env.get("PORT"));
6
7Deno.serve(
8 { port: !Number.isNaN(PORT) && PORT <= 65535 && PORT > 0 ? PORT : 8000 },
9 (req) => {
10 const path = new URL(req.url).pathname;
11 console.log("PATH", path);
12 switch (path) {
13 case "/styles.css":
14 return new Response(css, {
15 headers: {
16 "Content-Type": "text/css; charset=utf-8",
17 "Access-Control-Allow-Origin": "*",
18 },
19 });
20
21 case "/pds":
22 case "/pds/":
23 return pds();
24
25 case "/knot":
26 case "/knot/":
27 return knot();
28 }
29
30 console.warn(`Request for ${path} returned 404`);
31 return new Response("404 Not Found", {
32 status: 404,
33 statusText: "Not Found",
34 });
35 }
36);