1const express = require('express');
2const bodyParser = require('body-parser');
3
4const app = express();
5app.use(bodyParser.urlencoded({ extended: true }));
6
7app.post('/post-test', (req, res) => {
8 console.log('Got body:', req.body);
9 res.sendStatus(200);
10});
11
12app.listen(8080, () => console.log(`Started server at http://localhost:8080!`));
1const express = require('express');
2
3const app = express();
4
5app.use(express.json({extended: false})); //This is the line that you want to add
6
7app.post('/postroute', (req, res) => {
8 console.log('body :', req.body);
9 res.sendStatus(200);
10});