express res.json code example
Example 1: express redirect
res.redirect('/foo/bar')
res.redirect('http://example.com')
res.redirect(301, 'http://example.com')
res.redirect('../login')
Example 2: express req get json
const express = require('express');
const app = express();
app.use(express.json());
app.post('*', (req, res) => {
req.body; // The json object sent to the server
});
const port = 3000;
app.listen(port, () => console.log(`Listening on port ${port}.`));
Example 3: node js http request express
npm install [email protected]