Repository navigation
Description
- Used appropriate template for the issue type
- Searched both open and closed issues for duplicates of this issue
- Title adequately and concisely reflects the feature or the bug
Restify Version: 8.5.1
Node.js Version: v14.16.1
Expected behaviour
curl http://localhost:8880/api/users/a766c023-34ec-40d2-923c-e8259a28d2c5 should return Got:/api/users/:id
Actual behaviour
curl http://localhost:8880/api/users/a766c023-34ec-40d2-923c-e8259a28d2c5 returns {"code":"ResourceNotFound","message":"/api/users/a766c023-34ec-40d2-923c -e8259a28d2c5 does not exist"}
Repro case
var restify = require('restify');
const server = restify.createServer({
name: 'myapp',
version: '1.0.0'
});
server.use(restify.plugins.acceptParser(server.acceptable));
server.use(restify.plugins.queryParser());
server.use(restify.plugins.bodyParser());
const routes = [
'/api/users/award_winners',
'/api/users/admins',
'/api/users/:id',
'/api/:resourceType/',
]
routes.forEach(element => {
server.get(element, function (req, res, next) {
res.send("Got:" + element)
return next();
});
}
);
server.listen(8880, function () {
console.log('%s listening at %s', server.name, server.url);
});
Cause
I think it's related to delvedor/find-my-way#161
We encountered this issue originally while upgrading from an old version of restify, but going forward it means that if anyone adds another route, we could just break other routes in some non obvious way.
Are you willing and able to fix this?
In theory yes, although I'm not sure since I think it's a bug in the dependent project. I just didn't feel it was adequately captured in the bug reports for this project.
Activity
mainfraame commentedon Oct 27, 2022
ditto. This has caused me much pain and actually motivated me to move away from restify