nodejs get url params express code example
Example 1: node.js express post query string
const express = require('express');
const bodyParser = require('body-parser');
const app = express();
app.use(bodyParser.urlencoded({ extended: true }));
app.post('/somepost', (req, res) => {
console.log('Name:', req.query.name);
res.status(200);
});
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());
});