node-restify icon indicating copy to clipboard operation
node-restify copied to clipboard

Route not found

Open AaronTrazona opened this issue 6 years ago • 4 comments

Hi,

I'm using the restify 8.4.0 version, Suddenly I encounter an issue regarding routes.

I have these routes.

/user/update /user/home /:node/graph

when I requested /user/update or /user/home its working properly but when I requested /user/graph the server can't found this route.

the server should found this route since /:node/graph -- whatever we supply on "node" param its should be working.

This sample routes its working on 4.3.4 version.

Thanks

AaronTrazona avatar Dec 11 '19 23:12 AaronTrazona

Read this: https://github.com/delvedor/find-my-way#match-order

Hope it clarifies. I too faced this issue but post reading this, things got the required clarity.

manisuec avatar Jan 21 '20 12:01 manisuec

It seems an issue to me, based on the documentation they are reading the routes per chunk. If I'm correct.

Btw, these kind of routing its working fine on 4.3.4 version.

AaronTrazona avatar Jan 21 '20 19:01 AaronTrazona

the issue on POST method

I have 2 routes

server.post('/:node/sample', doSample) server.post('/:node', doEverything)

i tried to request /user/sample it will route to /:node instead of /:node/sample

AaronTrazona avatar Jan 29 '20 05:01 AaronTrazona

Hi @AaronTrazona , I stumbled across this bug, and may have more info. My guess and opinion after investigating this for the past 10 minutes, is that findmyway is just broken and misleading:

https://github.com/delvedor/find-my-way/issues/149 https://github.com/delvedor/find-my-way/issues/161

Essentially the way it works is it builds a tree of all routes, and then goes down that route based on matches so in your example it would have:

- user
   - update
   - home
- :node/graph

The URL requested matches user so it goes into that branch, then it can't find anything for graph and so it's a not found.

SJrX avatar Apr 27 '21 17:04 SJrX