Test 2 : Your API endpoint should respond with the correct name

Tell us what’s happening:

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36.

Challenge: undefined

Link to the challenge:

Solved It !!!

app.use(bodyParser.urlencoded({ extended: true }));
app.post("/name",function(req,res){

var jsonObj=req.body.first+" "+req.body.last;
res.send({name:jsonObj});
console.log(req.body.first+" "+req.body.last);

})

app.get("/", function(req, res) {
res.sendFile(path.join(__dirname + "/views/index.html"));
});