Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei 2024-06-25 19:01:14 +08:00 committed by GitHub
parent c423a7cba9
commit eed1c568e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -84,7 +84,7 @@ const app = new Hono();
for (const namespace in namespaces) {
const subApp = app.basePath(`/${namespace}`);
for (const path in namespaces[namespace].routes) {
const wrapedHandler: Handler = async (ctx) => {
const wrappedHandler: Handler = async (ctx) => {
if (!ctx.get('data')) {
if (typeof namespaces[namespace].routes[path].handler !== 'function') {
const { route } = await import(`./routes/${namespace}/${namespaces[namespace].routes[path].location}`);
@ -93,7 +93,7 @@ for (const namespace in namespaces) {
ctx.set('data', await namespaces[namespace].routes[path].handler(ctx));
}
};
subApp.get(path, wrapedHandler);
subApp.get(path, wrappedHandler);
}
}