Tell us what’s happening:
Describe your issue in detail here.
I kinda gave up on the last node exercise and I tried using the provided solution, but still it doesn’t seem to work.
Code of mine
var express = require(‘express’);
var bodyParser = require(‘body-parser’);
var app = express();
var absolutePath = __dirname + “/views/index.html”
app.post("/name", function(req, res) {
// Handle the data in the request
var string = req.bodyParser.first + " " + req.bodyParser.last;
res.json({ name: string });
});
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Firefox/97.0
Challenge: Get Data from POST Requests
Link to the challenge:
EDIT: I also tried the req.body command but that doesn’t seem to work either so I tried bodyParser but it also doesn’t work.