Re:MongoDB singleton connection in Node.Js
by latchkey on Friday April 05, 2013 @01:11PM
(#5499653)
This highlights the fact that nobody has created a good appserver for node yet. There is such a focus on web frameworks still that everyone keeps writing this code over and over again for their own apps. In my case, I wrote more of a 'service' layer with a set of lifecycle events because mongo generally isn't the only service that needs a connection. We have redis, neo4j, apns, etc. I then just 'require' my service wherever I need it in my application and have access to its connection. Services can also have dependencies on other services, such as a ram based caching layer that depends on pulling data from mongo.
[ Parent
| on HN ]
There are no comments on this comment yet.