better error handling

This commit is contained in:
Thomas Hobson 2021-04-23 14:47:08 +12:00
parent 46b1e9118d
commit e6da87faa9
No known key found for this signature in database
GPG Key ID: 9F1FD9D87950DB6F
1 changed files with 8 additions and 0 deletions

View File

@ -59,6 +59,14 @@ const app = express();
app.use(body_parser.urlencoded({ extended: true }));
app.use(body_parser.json());
app.use(function (err, req, res, next) {
return res
.status(400)
.send({
stack: err.stack
})
})
const validate = (req, res, next) => {
const errors = validationResult(req);