-
-
Notifications
You must be signed in to change notification settings - Fork 69
Description
(branched topic and response to #46 (comment))
@rvagg Thanks for chiming in and providing some feedback. I guess I'm really at a loss and seriously need help from those who have done this and what they recommend. I've been programming for almost 20 years in dozens of languages, frameworks, databases and architectures and I'm still not on the same page as many Node foundation members when it comes to the power and importance of having a reliable asynchronous context.
I love Node because it's lightweight but also can be a heavy hitter when needed (scaling). JS on the server and client streamlines data transfers and provides a high level of architectural flexibility and adaptability.
After using Node for 3+ years now, I still need to learn a 'best practice' architectures, design patterns or whatever you want to call it when it comes to passing context.
As a more concrete example, in our case, here's what we need to do:
Multi-tenant Database (our case MongoDB)
- ALL queries and writes need to ensure they have a shard key and/or client key and not leave it up to the developer to 'remember' to add it each time they want to query data.
- ALL changes to data need to be audit-able in order to track who changed what and when.
- Certain db data areas will need levels of authorization which again should not be left to the developer to remember the right authorization logic every time they want data from these areas. For example, this could be done by appending extra filter clauses to queries.
- Prefer Promises over callbacks
Ideally, all of this would be done at the data access layer so developer's can focus on building and adapting to business cases, testing and satisfying user stories.
I don't think these, what I consider enterprise-ish, requirements above are asking a lot and I would expect to be able to build an application in Node that could satisfy them.
At first glance, StrongLoop or Mongoose with middleware plugins appear to be solutions, but they are only as reliable as monkey patched shims can be in providing context over asynchronous boundaries.
How does Express or Hapi help with these requirements?
How have others used Node to satisfy these requirements?
Is there something fundamentally wrong with those requirements?
Any thoughts or guidance would be greatly appreciated.