Received the following error message after registering a Regular Expression as the route path, and a incoming request was being evaluated on it:
handlers[(i++)] is not a function
Found that the use function thought the base argument was a subapp handler because it wasn't a string. (it was an instance of RegExp)
pull request with unit test show casing example coming shortly.
Might consider some asserts on the input arguments to use to catch this sort of issue and provide a clearer error message. I was migrating some middleware from an existing app (that did self registering of routes) and had to jump through some hoops to figure out where this was. I don't mind adding the asserts, just let me know.
edit: also, not 100% sure why this module is responsible for ensuring a leading slash is on there. let me know if I need to modify anything with respect to that for backwards compatibility.
Received the following error message after registering a Regular Expression as the route path, and a incoming request was being evaluated on it:
Found that the
use
function thought thebase
argument was a subapp handler because it wasn't astring
. (it was an instance ofRegExp
)pull request with unit test show casing example coming shortly.
Might consider some asserts on the input arguments to
use
to catch this sort of issue and provide a clearer error message. I was migrating some middleware from an existing app (that did self registering of routes) and had to jump through some hoops to figure out where this was. I don't mind adding the asserts, just let me know.edit: also, not 100% sure why this module is responsible for ensuring a leading slash is on there. let me know if I need to modify anything with respect to that for backwards compatibility.