Use body-parser to Parse POST Requests

I’m working on the body-parser exercise. The error I get when I try to submit the code is that the body parser is not mounted correctly.
I’m not sure what I am missing, how do I mount it correctly?

My code is at https://bouncy-radio.glitch.me/

Below is a snippet of the code related to this exercise:

var bodyParser = require(‘body-parser’);

app.use(bodyParser.json());
app.use(function middle(req, res){
bodyParser.urlencoded({extended: false}). extended=false
});

Is there something else I need to do in order to mount the body-parser?

2 Likes

Finally was able to get it to pass the check, but this broke the webpage. I used code directly from the npm website, see link below:

I simply needed the following code:
app.use(bodyParser.urlencoded({ extended: false }));

I feel silly :weary:

5 Likes