Something is wrong: Get Data from post Requests

Tell us what’s happening:
Describe your issue in detail here.
Nothing is working. i read posts on the forum and applied the suggestions, nothing is working.

I even copy/pasted the solution offered by fcc itself but it’s NOT working. So then, what works?

app.post("/name", function(req, res) {
// Handle the data in the request
var string = req.body.first + " " + req.body.last;
res.json({ name: string });
});

Your project link(s)

solution: https://replit.com/@yellowflash2012/boilerplate-express

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 13904.41.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.81 Safari/537.36

Challenge: Get Data from POST Requests

Link to the challenge:

You need bodyParser middleware in order to use req.body.something
index.html probably too, req.body.something is some data from a form

Sorry but I don’t understand your english

You need to add this to make the middleware work

app.use(bodyParser.urlencoded({extended: false}))
1 Like

Thanks for your answer.
I don’t know if it’s nodejs that’s broken of if it’s fcc way of teaching it that’s broken but I’m done with learning nodejs for backend. I never want to hear about it again.

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