req. params in node js 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: route parameter in node
var express = require('express');
var fs = require('fs');
var app= express();
app.get('/index/profile/:id',function(req,res){
// res.send('profile with id' + req.params.id)
});
app.listen(3000,'127.0.0.1');
console.log('lsitng');