1The package bodyParser is deprecated. You will get this warning with these lines of code:
2
3app.use(bodyparser.json());
4app.use(bodyParser.urlencoded({extended: true}));
5
6If you are using Express 4.16+ you can now replace those lines with:
7
8app.use(express.json());
9app.use(express.urlencoded()); //Parse URL-encoded bodies
1If you are using the latest express module use this:
2
3app.use(express.json())
4app.use(express.urlencoded({extended: true}))
1//body-parser package is depreciated, to parse express now you just need these
2app.use(express.json()); //Used to parse JSON bodies
3app.use(express.urlencoded()); //Parse URL-encoded bodies
1body-parser has been deprecated from express v4.*
2Use body-parser package instead.
3npm i body-parser
4
5import bodyParser from "body-parser";//for typscript code only, use require for js
6app.use(bodyParser.json());
7app.use(bodyParser.urlencoded({ extended: false }));
1const express = require('express');
2
3app.use(express.urlencoded({ extended: true }));