You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Suppose we have a Hono app which looks like this:
This will return a response like this:
However,
I want all of my API's response shape to look like the following:
But I don't necessarily want to return { code: xx, data: xx, ....... } on every handler.
So I was thinking of registering a global middleware like this:
However this breaks the type safety when using with
hono/client
- it shows the original types instead of the transformed ones.Is there a way to solve this? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions