About the find method
3imed-jaberi opened this issue · comments
Hi @fundon,
I was created a Router for Koa based on Trek-Router.
I want to support 405 method not allowed
and 501 path not implemented
as you can see here but I can't do that with the current result of find
method because we don't have any indicator about path was finded or not.
So, if there is any other way to get what I ask. or please add something added to result to be like that;
const route = TrekRouter.find(method, path)
const [handler, params, findedPath] = route
// !handler && findedPath === false => 501 path not implemented.
// !handler && findedPath === true => 405 method not allowed.
@3imed-jaberi Do you fix that?
@fundon, No, I just tried to fix that, but my solution affects the performance as it solves only the static routes. Otherwise not work with param or any-match routes.
So please can you provide this feature or can you improve the variable names so that I can help here ?!