I am facing an issue with parameter based routes on latest version of uWebsockets.js (v20.40.0),
To illustrate the problem, I have created an example app below:
const uWS = require('uWebSockets.js');
const app = uWS.App()
.get('/something/:id/sync', (res, req) => {
res.end('sync endpoint');
})
.get('/something/:somethingId/pin', (res, req) => {
res.end('pin endpoint');
})
.get('/something/:id/:attribute', (res, req) => {
res.end('attribute endpoint');
})
.listen(9000, (token) => {
if (token) {
console.log('Listening to port ' + 9000);
} else {
console.log('Failed to listen to port ' + port);
}
});
In this application, Request GET /something/1234/pin returns attribute endpoint as result while expected response is pin endpoint.
I went through the routing strategy of uWebsockets which mentions that routes are matched in the order of specificity which implies that pin endpoint should be the above response.
Also, if :somethingId is changed to :id, routing works as expected. Would like to understand if this is a bug with uWebsockets.
Hey,
I am facing an issue with parameter based routes on latest version of uWebsockets.js (v20.40.0),
To illustrate the problem, I have created an example app below:
In this application, Request
GET /something/1234/pin
returnsattribute endpoint
as result while expected response ispin endpoint
.I went through the routing strategy of uWebsockets which mentions that routes are matched in the order of specificity which implies that
pin endpoint
should be the above response.Also, if
:somethingId
is changed to:id
, routing works as expected. Would like to understand if this is a bug with uWebsockets.Thank you!