Answers for "add multiple params to express params"

0

add multiple params to express params

app.get('/hello/:firstname/:lastname', (req, res) => {
	console.log(req.params);
	res.send('hello ' + req.params.firstname + ' ' + req.params.lastname);
});
Posted by: Guest on June-01-2021
0

expressjs path multiple params

app.get('/fruit/:fruitName/:fruitColor', function(req, res) {
    var data = {
        "fruit": {
            "apple": req.params.fruitName,
            "color": req.params.fruitColor
        }
    }; 

    send.json(data);
});
Posted by: Guest on January-29-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language