1var express = require('express')
2
3var app = express()
4
5app.use(express.json()) // for parsing application/json
6app.use(express.urlencoded({ extended: true })) // for parsing application/x-www-form-urlencoded
7
8app.post('/profile', function (req, res, next) {
9 console.log(req.body)
10 res.json(req.body)
11})
12
1<script>
2const bodyParser = require("body-parser");
3
4app.use(bodyParser.urlencoded({extended:true}));
5
6app.post("/", function(req, res){
7 let firstName = req.body.fNAME;
8
9});
10</script>
11
12<input type="text" name="fNAME" placeholder="First Name">
1app.use(bodyParser.json()); // for parsing application/jsonapp.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencodedapp.use(multer()); // for parsing multipart/form-data