Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Added to Readme how to add a authorizer directly to the router instead of app. #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

romuloberri
Copy link

We had to use the basic auth on one of our routers today and we figured out in the code that it is possible to add to only one router instead of the whole app.
And it was very useful in our case because we have our express app created and configured in the main file and each route is implemented on its own file and only one route needs the basic auth.

I hope this README update can help in the future whoever needs this as well.

@spacestierman
Copy link

Just wanted to add that this documentation would have helped me as well. I started writing my own fork of this repo just to add this specific feature, then saw the examples the tests.js file how to add it to specific routes and found this PR when I went digging.

This technique also lets you apply basicAuth selectively to only certain routes, which is what I wanted to use it for. Please accept this PR, or update the documentation with similar notes!

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

Successfully merging this pull request may close these issues.

3 participants