Home > Enterprise >  TypeError: bodyParser.urlecoded is not a function
TypeError: bodyParser.urlecoded is not a function

Time:09-27

I use nodejs and express for my back-end web development.

I want the app to use bodyParser app.use(bodyParser.urlencoded({extended: true}));

But I am getting this error on my server:

TypeError: bodyParser.urlecoded is not a function

How can I solve this issue?

CodePudding user response:

This should solve the issue :

const express = require('express');
const app = express();
app.use(express.json({ extended: true }));

CodePudding user response:

Try this instead

const express=require('express');
app.use(express.urlencoded({extended:true}));

express.urlencoded() middleware has been added to provide request body parsing

  • Related