We have been using Grapnel router in our project, and it works really well for our requirements, so we want to keep using it.
However we have had an issue when upgrading the library from version 0.6.4 to 0.7.2 because the router.get method does not bind the specified path pattern to the given function. It only works as expected for the wildcard '*'.
So the following works as expected and myHandler gets fired for the wildcard '*':
We do not have the permissions to create a pull request from this fork to your repository, or to create a branch, so we have decided to raise this issue. It would be awesome if you could check it out, and help us address this :)
@rockaBe @crisperpo There was a problem with the build scripts. They've been reverted to 0.6.x's build system, so please update to the latest version grapnel@0.7.6
Hi there,
We have been using Grapnel router in our project, and it works really well for our requirements, so we want to keep using it.
However we have had an issue when upgrading the library from version
0.6.4
to0.7.2
because therouter.get
method does not bind the specified path pattern to the given function. It only works as expected for the wildcard '*'.So the following works as expected and
myHandler
gets fired for the wildcard '*':For any other path pattern value different than '*' however the handler is never fired. For example:
After doing some research we found out that the issue happens because of the following:
The
add
method is called by theget
methodThe route is created based on the
fullPath
value:The root is removed from the route:
The script checks if the route matches the pattern after removing the root:
No matches are found so the function is not bound to the specified path
We found out that the solution to this issue is to use
routePath
instead offullPath
when creating theroute
as follows:We have addressed the issue in the following fork that we are currently using as a dependency in our project:
https://github.com/crisperpo/grapnel
We do not have the permissions to create a pull request from this fork to your repository, or to create a branch, so we have decided to raise this issue. It would be awesome if you could check it out, and help us address this :)