Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

About the find method #23

Open
3imed-jaberi opened this issue Jan 19, 2021 · 2 comments
Open

About the find method #23

3imed-jaberi opened this issue Jan 19, 2021 · 2 comments

Comments

@3imed-jaberi
Copy link

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.
@fundon
Copy link
Member

fundon commented Mar 3, 2021

@3imed-jaberi Do you fix that?

@3imed-jaberi
Copy link
Author

@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 ?!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants