fix: debugging this problem
This commit is contained in:
parent
ea3f379b1b
commit
3fc77f009d
2 changed files with 5 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@andyburke/serverus",
|
"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.",
|
"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",
|
"license": "MIT",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": "./serverus.ts",
|
".": "./serverus.ts",
|
||||||
|
|
|
@ -6,9 +6,10 @@
|
||||||
import * as colors from '@std/fmt/colors';
|
import * as colors from '@std/fmt/colors';
|
||||||
import * as path from '@std/path';
|
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({
|
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. */
|
/** 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;
|
type HANDLER = (request: Request) => Promise<Response | null | undefined> | Response | null | undefined;
|
||||||
|
@ -109,13 +110,11 @@ export class SERVER {
|
||||||
DEFAULT_HANDLER_DIRECTORIES;
|
DEFAULT_HANDLER_DIRECTORIES;
|
||||||
|
|
||||||
for (const handler_directory of HANDLERS_DIRECTORIES) {
|
for (const handler_directory of HANDLERS_DIRECTORIES) {
|
||||||
const root_directory = path.resolve(handler_directory);
|
const index_file = path.join(handler_directory, 'index.ts');
|
||||||
const index_file = path.join(root_directory, 'index.ts');
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const handlers_index = await import(index_file);
|
const handlers_index = await import(index_file);
|
||||||
console.dir({
|
console.dir({
|
||||||
root_directory,
|
|
||||||
index_file,
|
index_file,
|
||||||
handlers_index
|
handlers_index
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue