feature: execute load()/unload() methods found in _pre.ts files

This commit is contained in:
Andy Burke 2025-08-11 17:12:55 -07:00
parent df8291bfc7
commit 046617bc4f
7 changed files with 116 additions and 62 deletions

View file

@ -25,6 +25,7 @@ type LOGGER = (request: Request, response: Response, processing_time: number) =>
*/
interface HANDLER_MODULE {
default: HANDLER;
load?: () => void | Promise<void>;
unload?: () => void | Promise<void>;
}
@ -146,6 +147,10 @@ export class SERVER {
}
this.handlers.push(handler_module);
if (handler_module.load) {
await handler_module.load();
}
}
} catch (error) {
if (error instanceof Deno.errors.NotFound) {