Jesse
Jesse
HHono
Created by Jesse on 2/13/2025 in #help
Factory app creation
Hi, I'm building a backend using Hono and am splitting up my routes into groups, for example '/authors', and '/books'. Each group is written in a separate file and then imported to the main Hono app which will serve the app. Right now I have authentication middleware on the main app and in that middleware the "user" context is set so we can access the current user on the routes below, however since the "books" and "authors" sub-apps are imported to the main app from a different location they don't have access to the context set by the middleware in the main app. In the "books" app I want to be able to access the "user" context from the middleware. What is the recommended way of doing this? nb: It seems like createFactory().createApp() was the recommended way to do this, however this seems to be deprecated?
7 replies