1app.get('/path/:name', function(req, res) {
2 res.send("tagId is set to " + req.params.name);
3});
1GET /something?color1=red&color2=blue
2
3app.get('/something', (req, res) => {
4 req.query.color1 === 'red' // true
5 req.query.color2 === 'blue' // true
6})
1app.get("/users/:id",(req,res)=>{ // https://domain.com/users/817178
2 const id = req.params.id ; // 817178
3})
4app.get("/users?name=anas",(req,res)=> { // https://domain.com/users?name=anas
5const name = req.query.name ; //anas
6})
1// http://localhost:8080/api/1
2app.get('/api/:version', function(req, res) {
3 res.send(req.params.version);
4});