Express autodetection doesn't work properly
It seems that the approach for Express autodetection is by patching the connect's HTTPServer use() function in memory:
https://github.com/bnoguchi/everyauth/commit/b854bc5b3ea9709305a8cb7e90a1870600d86fa0#index.js
For some reason this doesn't work in my application, which uses everyauth indirectly through mongoose-auth (don't know if that's relevant since mongoose-auth clearly delegates middleware() and helpExpress() function calls without interfering).
My app hooks up everyauth this way:
config.app.use(mongooseAuth.middleware());
After adding some debug statements to everyauth/index.js, I've determined that everyauth's middleware() function gets run, but the replaced connect use() implementation isn't. Probably because, in my case, use() call happens (begins) before everyauth middleware() patches it.
Besides, the fact that everyauth middleware() can potentially be called by connect's methods and then itself reaches to connect's method (and overrides its implementation - regardless of whether their code is compatible or not!) creates a cyclic dependency between everyauth and connect.
In general, this causes real problems and is an example of:
bad code smells:
- inappropriate intimacy (a class that has dependencies on implementation details of another class)
- cyclic dependency
violations of at least 2 [SOLID](http://en.wikipedia.org/wiki/Solid_(object-oriented_design)) principles:
All that in the name of saving the programmer from making a single function call (helpExpress()), and with a price that he cannot decide anymore about the moment when it is performed.
I vote for the revert of commit b854bc5b3ea9709305a8cb7e90a1870600d86fa0 and bringing back the helpExpress() function, which has worked just fine.
I'm in the exact same situation and my app doesn't work anymore since the update. Is there a workaround so I could stay with the master branch ?
Definitely agree. I'm in the same situation as well.
@aadamowski Have you tried using this branch instead? https://github.com/bnoguchi/everyauth/tree/express3 It is working for me (after updating to Express3)
I am in the same situation and agree with the course of action specified in this pull request.
+1
@dluces I didn't, unfortunately I don't currently have time to migrate my app to Express 3.
Same situation. Backed out of mongoose_auth, and am implementing db logic myself because of this issue.
Has anyone acknowledged or reviewed the pull requests to revert prior changes? I have the same issues as above.
+1. same issues here, at east give us back the helpExpress method to do what it once did.
I am seeing the same problem. Is there any recent news on this?
+1