I try to retrieve multiple GET parameters with Express, but req.params is always empty. I am not entirely sure how to do it properly with Express 4 as the answers vary a lot because there has changed a lot with newer releases of Express/Node.js I guess.
This is my URL call:
http://localhost:3000/accounts/players?term=asddsa&_type=query&q=asddsa
The http status code is actually 200 so this address actually exists.
This is my router:
router.get('/players', function(req, res) {
var searchTerm = req.term;
console.log("Term: " + JSON.stringify(req.params));
res.json({"result": "Account deleted"});
});
Console log output is:
Term: {}
I have tried different things such as:
router.get('/players/:term/:_type/:q', function(req, res) {
But this caused a 404 for the GET request.