I need to create url for get which is going to accept array, how in node.js/express extract array from request ? I need to pass array with names which parametes I need to ba
You can pass array elements separated by slashes - GET /api/person/foo/bar/...
Define your route as '/api/person/(:arr)*'
req.params.arr will have the first parameter.
req.params[0] will have the rest as string.
You split and create an array with these two.
app.get('/api/person/(:arr)*', function(req, res) {
var params = [req.params.arr].concat(req.params[0].split('/').slice(1));
...
});
GET /api/person/foo
params = ["foo"]
GET /api/person/foo/bar
params = ["foo", "bar"]
...