express multiple params code example
Example 1: 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);
});
Example 2: 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);
});