HonoH
Hono11mo ago
Ayoub

Extract routes from hono definition

Hi everyone, i want to extract all the routes from hono definition for example :

export const app = new Hono<Env>()
  .route('/transactions', transactionsRoute);


How is it possible ?
I want to make a function that take a typesafe parameter that will be the route

const fn = (route: AnyPossibleRoute) => {}


and when i call the function fn, there will be autocompletion and i can have these possible options : /api/transactions /api/transactions/all /api/transactions/:id etc ...

I'm fighting with ExtractSchema utility type but I don't achive my goal
Thanks.
Was this page helpful?