feature: execute load()
/unload()
methods found in _pre.ts
files
This commit is contained in:
parent
df8291bfc7
commit
046617bc4f
7 changed files with 116 additions and 62 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue