I have a Node.js server which is handling post methods like this:
app.post('/app/:id:second',function(req,res){
console.log('Post received');
res.end();
})
How can I pass 2 or more parameters to my server in a URL? How should the url look like? I tried it like this but it failed: http://localhost:8080/app/id=123&second=333
I'm a beginner in web apps.
Use bodyParser
midleware, for example:
var bodyParser= require('body-parser');
app.use(bodyParser.urlencoded());
app.post('/app/:id',function(req,res){ //http://localhost:8080/app/123?second=333
console.log(req.query); //{second: 333}
console.log(req.params); // {id: 123}
res.end();
})