Abstracted routes but with context and types
I know there's some discussion of abstracted routes under https://hono.dev/docs/guides/best-practices. But there's no example which preserves the types from the context or middleware.
How should I construct
hello.ts
so that the subroutes all have access to db
in the context?2 Replies
You can use the same factory to create the app in
hello.ts
. So first abstract the createFactory
logic in a separate file and use it's createApp
function to create app for the both the routersSuper thanks.