How can I pass an unknown number of params to NodeJS routes, and save them to an array?:
http://127.0.0.1:3000/param1/param2/param3...
I thought about doing:
app.get('/*', myHandler);
And just tokenize the string, but there should be a better way.
It looks like you are using express routing in NodeJS. If so, you might want to experiment with the regular expressions. Like the following will give you the full path (/vararg/) in req.params[0] but there may be a better way:
app.get(/^\/vararg\/(.*)/, function(req,res) {
res.send("Got parameters : " + req.params[0]);
})
So if I do a get on localhost:3000/vararg/foo/bar/gar it will send:
Got parameters : foo/bar/gar
Or localhost:3000/vararg/foo will produce:
Got parameters : foo
And then you can split the parameter into the other parts.