From 5d25afc329ae402380759f4e47a85cb89297f9f7 Mon Sep 17 00:00:00 2001 From: Andy Burke Date: Sun, 22 Jun 2025 14:22:23 -0700 Subject: [PATCH] fix: remove debugging for path issues fix: resolve handlers via an index --- deno.json | 2 +- server.ts | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/deno.json b/deno.json index 535aca2..f845be0 100644 --- a/deno.json +++ b/deno.json @@ -1,7 +1,7 @@ { "name": "@andyburke/serverus", "description": "A flexible HTTP server for mixed content. Throw static files, markdown, Typescript and (hopefully, eventually) more into a directory and serverus can serve it up a bit more like old-school CGI.", - "version": "0.0.10", + "version": "0.0.11", "license": "MIT", "exports": { ".": "./serverus.ts", diff --git a/server.ts b/server.ts index 0e4a3be..648a951 100644 --- a/server.ts +++ b/server.ts @@ -7,10 +7,7 @@ import * as colors from '@std/fmt/colors'; import * as path from '@std/path'; const DEFAULT_HANDLER_DIRECTORIES = [import.meta.resolve('./handlers')]; -console.dir({ - meta: import.meta, - DEFAULT_HANDLER_DIRECTORIES -}); + /** A `HANDLER` must take a `Request` and return a `Response` if it can handle it. */ type HANDLER = (request: Request) => Promise | Response | null | undefined; @@ -114,10 +111,7 @@ export class SERVER { try { const handlers_index = await import(index_file); - console.dir({ - index_file, - handlers_index - }); + for (const handler_name of Object.keys(handlers_index.default)) { const handler_module: HANDLER_MODULE = handlers_index.default[handler_name]; if (typeof handler_module?.default !== 'function') {