expressjs response code example
Example 1: express set response code
res.status(400);
res.send('None shall pass');
Example 2: node js http request express
npm install request@2.81.0
Example 3: express render
// send the rendered view to the client
res.render('index')
// if a callback is specified, the rendered HTML string has to be sent explicitly
res.render('index', function (err, html) {
res.send(html)
})
// pass a local variable to the view
res.render('user', { name: 'Tobi' }, function (err, html) {
// ...
})