HonoH
Hono8mo ago
Rowin

Recommended way to register routes across files

What's the recommended way to register routes across files? I like to have 1 handler per file, and right now I do this:

export function registerExampleRoute(app: Hono) {
  app.get("/example", async (c) => {
    return c.json({ hello: "Hello!" });
  });
}


Which works fine for path variables typings and such, but I lose all Hono typings. Should I create a factory for each route instead?
Was this page helpful?