npm install body-parser
const express = require('express');
// step 1
const bodyparser = require("body-parser");
const app = express();
// step 2
app.use(bodyparser.json())
app.post('/register', (req, res) => {
// step 3 access body property
let jsondata = req.body;
// step 4 get value for specific property
let name = jsondata.name;
let roll = jsondata.roll;
res.send("your name is :"+ name +"roll is "+ roll);
});
const port = 3000;
app.listen(port, () => {
console.log('Server listening on port 3000');
});