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');
More Related Contents:
- Push items into mongo array via mongoose
- How to share sessions with Socket.IO 1.x and Express 4.x?
- How can I set NODE_ENV=production on Windows?
- What does body-parser do with express?
- How to include route handlers in multiple files in Express? [duplicate]
- How to redirect 404 errors to a page in ExpressJS?
- Node/Express file upload
- npm WARN package.json: No repository field
- socket.io and session?
- Order of router precedence in express.js
- How to modify the nodejs request default timeout time?
- What is the difference between res.end() and res.send()?
- Express next function, what is it really for?
- Redirecting to previous page after authentication in node.js using passport.js
- Mongoose update without callback
- What does middleware and app.use actually mean in Expressjs?
- What is a good session store for a single-host Node.js production app?
- Express: How to pass app-instance to routes from a different file?
- Uploading images using Node.js, Express, and Mongoose
- POST request not allowed – 405 Not Allowed – nginx, even with headers included
- Use a variable in a Jade include
- How to send a pdf file from Node/Express app to the browser
- How to fix ‘Error: querySrv EREFUSED’ when connecting to MongoDB Atlas?
- Express.js req.ip is returning ::ffff:127.0.0.1
- What is the difference between res.send and res.write in express?
- What is best way to handle global connection of Mongodb in NodeJs
- Call a “local” function within module.exports from another function in module.exports?
- Model.find() returns empty in mongoose [duplicate]
- Passing arguments to require (when loading module)
- Node.js – logging / Use morgan and winston