I have tried:
app.get(\'/\', function(req, res, next) { var e = new Error(\'error message\'); e.status = 400; next(e); });
and:
Per the Express (Version 4+) docs, you can use:
res.status(400); res.send('None shall pass');
http://expressjs.com/4x/api.html#res.status
<=3.8
res.statusCode = 401; res.send('None shall pass');