Answers for "req.param express"

28

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
});
Posted by: Guest on January-29-2021
0

What are "res" and "req" parameters in Express functions

app.get('/people.json', function(request, response) { });
Posted by: Guest on May-15-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language