From 3fc77f009dc0de87c1f2ce2bf4241344349e47bd Mon Sep 17 00:00:00 2001 From: Andy Burke Date: Sun, 22 Jun 2025 14:19:16 -0700 Subject: [PATCH] fix: debugging this problem --- deno.json | 2 +- server.ts | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/deno.json b/deno.json index 31c6025..535aca2 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.9", + "version": "0.0.10", "license": "MIT", "exports": { ".": "./serverus.ts", diff --git a/server.ts b/server.ts index b4ce180..0e4a3be 100644 --- a/server.ts +++ b/server.ts @@ -6,9 +6,10 @@ import * as colors from '@std/fmt/colors'; import * as path from '@std/path'; -const DEFAULT_HANDLER_DIRECTORIES = [path.join(import.meta.dirname ?? '.', 'handlers')]; +const DEFAULT_HANDLER_DIRECTORIES = [import.meta.resolve('./handlers')]; console.dir({ - meta: import.meta + 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; @@ -109,13 +110,11 @@ export class SERVER { DEFAULT_HANDLER_DIRECTORIES; for (const handler_directory of HANDLERS_DIRECTORIES) { - const root_directory = path.resolve(handler_directory); - const index_file = path.join(root_directory, 'index.ts'); + const index_file = path.join(handler_directory, 'index.ts'); try { const handlers_index = await import(index_file); console.dir({ - root_directory, index_file, handlers_index });