App mount path stripped to a of cardinality of 1
See original GitHub issueHey, thanks for writing this. I’m a huge fan of Express/NodeJS web service alternatives.
It looks like the cardinality of the mounting path of each middleware/app is stripped to a limit of 1.
Example:
const app = require('polka')();
app
.use('/foo/bar/baz', function(_, res) {
res.end();
})
.listen(3000);
If I visit localhost:3000/foo/bar/baz, I will get a 404. I think this is because of the value function, it checks for the first slash after the leading. So, if I provide:
/foo/bar/baz
, the first slash is the zeroeth position of the string and the string itself is stripped to foo
.
Is this by design? If this is done in error, it can easily be fixed with some language around how the trailing slash should be considered, or by using lastIndexOf
. It also works if I just don’t consider the value function at all.
Additionally, it looks like there is a mountpath
instance property, but it is not set from the constructor, perhaps this could be used in some way?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:11 (4 by maintainers)
Top GitHub Comments
Looks to be okay @Conduitry – linked the latest commit to here as a follow-up
Opps, sorry my lack of experience with installing version tags. All good now! Fix works, thanks!