This challenge is hard to me help

**I have installed body-parser on this challenge hope am right.the problem is am not completing the challenge **
solution link: https://boilerplate-express.nanasv.repl.co

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 8.1.0; itel A16 Plus) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.93

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

app.post(’/name’, (req, res) => {
let name = req.body.first + ’ ’ + req.body.last;
res.json({name: name});
});

module.exports = app;
`Mobile Safari/537.36
.

Challenge: Get Data from POST Requests

Link to the challenge:
https://www.freecodecamp.org/learn/apis-and-microservices/basic-node-and-express/get-data-from-post-requestsPreformatted text

When asking for help please post the link to your code, not just the live app URL.


What happened to the code from the challenge before this one? Where are you using the body-parser middleware?

1 Like

I don’t really understand your question, but I try to follow the instructions. Sorry is there any thing that am missing?
The code ones again. Please tell me where am wrong

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

app.post(’/name’, (req, res) => {
let name = req.body.first + ’ ’ + req.body.last;
res.json({name: ‘firstname lastname’});
});

module.exports = app;
`

you are missing the middleware mounted app.use(bodyParser.urlencoded({ extended: false }));
Did you not follow correctly the instructions for the previous challenge?
For you to read the req.body, it first needs to be decoded by the bodyParser method(which is a middleware)

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.