Skip to content

Commit

Permalink
update template
Browse files Browse the repository at this point in the history
  • Loading branch information
tinchoz49 committed Oct 19, 2024
1 parent 59e55ef commit a965d7c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ interface RouteModule {
prefix?: string
}

const router = (app: App) => async <T extends Promise<RouteModule>>(module: T) => {
const { default: routes, prefix } = await module
return app.register(routes, { prefix })
}

export default async function routes(app: App) {
const register = router(app)
const register = async <T extends Promise<RouteModule>>(module: T) => {
const { default: routes, prefix } = await module
return app.register(routes, { prefix })
}

return Promise.all([
register(import('./health.js')),
register(import('./posts.js')),
Expand Down

0 comments on commit a965d7c

Please sign in to comment.