res.body express code example

Example 1: express req body

app.post('/login', (req, res) => {
  console.log(req.body.email) // "[email protected]"
  console.log(req.body.password) // "helloworld"
})

Example 2: node js http request express

npm install request@2.81.0

Example 3: response.render

// here you set that all templates are located in `/views` directory
app.set('views', __dirname + '/views');

// here you set that you're using `ejs` template engine, and the
// default extension is `ejs`
app.set('view engine', 'ejs');

// here you render `orders` template
response.render("orders", {orders: orders_json});