fix: debugging this problem

This commit is contained in:
Andy Burke 2025-06-22 14:19:16 -07:00
parent ea3f379b1b
commit 3fc77f009d
2 changed files with 5 additions and 6 deletions

View file

@ -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",

View file

@ -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> | 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
});