This release includes a major bug fix that changes a bit how the API works.
Changes
- 03914d9 Added
express-async-errors
to catch asynchronous errors from express - 03914d9 Added
on-finished
andon-headers
as dependencies of the logger - 03914d9 Changed the way errors are sent from the API to a definitive and clean one:
Instead of a reponse witherror
,message
andstatus
like I wrote in the docs, which was almost always false, the errors are now in a definitive format:
{
"error": {
"message": "The message of the error",
"code": 500,
"type": "the type of the error (mostly useful in the backend)"
}
}
And if the route contained validation:
{
"error": {
"message": "Validation Failed",
"code": 400,
"type": "ValidationError"
},
"errors": {
...
}
}
Where the errors
field contains express-validator
's validationResults#array
.
- 03914d9 Changed the way the endpoints were being grabbed: this is now automated from a property
infos
of typeAPIRouteInfos
that is retrieved at the start of the backend - 03914d9 Optimized the
owoify
route with an unified middleware to handle the requests in both POST and GET methods