This commit is contained in:
2026-01-01 00:49:42 -05:00
parent 32ef24d8e3
commit 270f93ba04

View File

@@ -27,7 +27,7 @@ Deno.serve({
hostname: NET_HOST, hostname: NET_HOST,
port: NET_PORT, port: NET_PORT,
onListen: addr => console.log(`Listening on http://${addr.hostname}:${addr.port}`) onListen: addr => console.log(`Listening on http://${addr.hostname}:${addr.port}`)
}, req => { }, (req, addr) => {
const notFound = new Response("Not Found. Did you try thinking Miku?", { const notFound = new Response("Not Found. Did you try thinking Miku?", {
status: 404, status: 404,
statusText: "Not Found (oo-ee-oo)", statusText: "Not Found (oo-ee-oo)",
@@ -40,7 +40,7 @@ Deno.serve({
const mapping = mappings.find(val => val.endpoints.some(val => url.pathname === val)); const mapping = mappings.find(val => val.endpoints.some(val => url.pathname === val));
console.log(`${req.method} ${url.pathname} | mapping exists: ${typeof mapping !== 'undefined'}`); console.log(`${addr.remoteAddr.hostname}:${addr.remoteAddr.port} ${req.method} ${url.pathname} | mapping exists: ${typeof mapping !== 'undefined'}`);
return new Promise<Response>(resolve => { return new Promise<Response>(resolve => {
if (mapping) { if (mapping) {
Deno.readFile(path.join(WEB_ROOT, mapping.path)).then(data => { Deno.readFile(path.join(WEB_ROOT, mapping.path)).then(data => {