-
I want to create a default response body for every incoming request, is there any option to do that? example: app.get('/', c => {
return c.json({
name: 'FlixAPI'
});
}); im expecting output response body when requesting {
"error": false,
"message": "success",
"data": {
"name": "FlixAPI" // from `c.json`
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
EdamAme-x
Jan 23, 2025
Replies: 1 comment 4 replies
-
You can // register handlers without `return`, add `next`
... (e.g. app.get("/", async (c, next) => { ...; await next() }))
app.use("*", (c) => {
// default
return c.json(...)
}) |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey @flixyudh
Please try to use this