I wrote a resource, to which a user can send data. If the data does not validate (validation returns false), I need to send an error 500 status code to the client, but the problem is, that when I use res.status(500), the program exits
and I just want to cancel this request with an error to the client, not stopping the program...
function formHandler(req, res, next) {
let isValid = validate(fields.token)
if (!isValid) {
res.status(500).send({ error: 'invalid!' })
}
resis not defined in that scope