post get express code example
Example 1: express js params
app.get('/path/:name', function(req, res) { // url: /path/test
console.log(req.params.name); // result: test
});
// OR
app.get('/path', function(req, res) { // url: /path?name='test'
console.log(req.query['name']); // result: test
});
Example 2: node js express url parameters
// http://localhost:8080/api/1
app.get('/api/:version', function(req, res) {
res.send(req.params.version);
});