route query params express code example
Example 1: express get params after ?
GET /something?color1=red&color2=blue
app.get('/something', (req, res) => {
req.query.color1 === 'red' // true
req.query.color2 === 'blue' // true
})
Example 2: get value from path variable node js
exports.doIt = function(req, res, next) {
var group = new Group(req.body);
console.log(req.params);
group.userId = req.params.userId;
group.save(new dataCallbacks(req, res, next, "Group").insert());
});