I want to parse simple routes like these:
http://example.com/foo/bar/baz/
where there is no theoretical limitation to the number of them. A
Use a regular expression.
app.get(/^\/((?:[^\/]+\/?)+)\//, function(req, res) { res.send(req.params[0].split('/')); }); app.listen(8080);
Run it and then
$ curl localhost:8080/foo/bar/baz/ ["foo","bar","baz"]