Commit 760f5083 authored by Jarrod's avatar Jarrod 💬

Custom 404 middleware.. broken badRequest

parent 353fb162
......@@ -27,7 +27,16 @@ module.exports = new Pluggable({
const { req, res } = this
const message = !arg ? 'Invalid request' : _.isString(arg) ? arg : _.isObject(arg) && arg.message ? arg.message : 'Bad Request'
res.status(400).send({
error: 'Bad Request',
error: 'E_BADREQUEST',
message
}).end()
}
sails.middleware.responses.notFound = function notFound (arg) {
const { req, res } = this
const message = !arg ? 'Resource not found' : _.isString(arg) ? arg : _.isObject(arg) && arg.message ? arg.message : 'Resource not found'
res.status(404).send({
error: 'E_NOTFOUND',
message
}).end()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment