I need to follow a spec that requires a GET using a "path" in route path.
Scenario #1: https://example.com/param1/param2/file.txt
Scenario #2: https://example.com/param1/param2/folder/file.txt
Initially I tried with the very standard implementation:
app.get('/:param1/:param2/:path', (req, res) => {
res.send(req.params)
})
It works as expected for first scenario. However for second one I receive a 404 as express router looks for the complete path, that of course.. does not exist.
I know, passing the path as url parameter would easily solve this problem. But requirements are to use the path... as path.
How can I trick express router to get the rest of the path as my last parameter?
Thank you!