This serves to make your project's response standard, people's habits in creating rest apis sometimes result in inconsistent responses.
standard json response will look like this
{
"success": false,
"message": "Bad Request!",
"errors": {
"email": ["email required!", "other errors"]
},
"data": {...}
}
response template customization:
The function name is still a plan, it will probably change when we start working on it hehe.
app.responseHandle((ctx,beforeRes) => {
return ctx.send({
status: beforeRes.status >= 200 && beforeRes.status < 300,
data: beforeRes.body
});
});
This serves to make your project's response standard, people's habits in creating rest apis sometimes result in inconsistent responses.
standard json response will look like this
{ "success": false, "message": "Bad Request!", "errors": { "email": ["email required!", "other errors"] }, "data": {...} }response template customization:
The function name is still a plan, it will probably change when we start working on it hehe.