Best way to selectively bypass/ignore everyauth middleware
I'd like to avoid the overhead of everyauth middleware for some of my routes, which don't require authentication and shouldn't be querying my database (findUserById..)
I've got a hack working whereby I use custom middleware to declare unauthenticated routes before the everyauth middleware, using switch/when statements to pass queries to my controllers based on req.originalUrl. (Using normal express route declaration would break my other routes if declared before everyauth middleware). Afterwards, I include the express helpers, and then declare routes which require authentication.
My issues:
- I'd like to be able to use standard express syntax for declaring all my routes
- The recent changes to everyauth which implicitly add helpers/middleware may interfere with my hack, because I'm not sure how to explicitly position the express middleware in the middleware chain
+1 - me too
+1 - would be great to be able to provide custom middleware to the auth and callback routes.