In Express >= 4.16, body parser has been re-added under the methods express.json().
The replacement for the above question is
const express = require("express");
const app = express();
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
The extended option allows to choose between parsing the URL-encoded data with the querystring library (when false) or the qs library (when true). The “extended” syntax allows for rich objects and arrays to be encoded into the URL-encoded format, allowing for a JSON-like experience with URL-encoded. For more information, please see the qs library here.
Defaults to true, but using the default has been deprecated. Please research into the difference between qs and querystring and choose the appropriate setting.