How to accept parameters from base path ? #3234
Unanswered
sterlinghagoromo
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Say I have an API like this:
PATCH /:storeId/products/:productId
For codebase management reasons I'm trying to setup hono so that my core routing file has all the base API paths, and then each major group of routes has their local paths only. However that breaks type inference for RPC usage if I leave parameters in the base path. I there some better way of doing this correctly ? or is it part of Hono's philosophy that all params must be present in the app that handles the route ?
Like this:
Doing it as per above breaks RPC because param will have extra type definitions than expected.
If I move all the params inside the app that handles them, it works fine, but that forces me to mount all apps on the top level "/" path.
You can see the full gist here with screenshot and detailed errors here:
https://gist.github.com/sterlinghagoromo/c822866ddeab8b7e46a1c8e9e34e6028
Beta Was this translation helpful? Give feedback.
All reactions