Open romuloberri opened 2 years ago
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!
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.