nx-serverless
nx-serverless copied to clipboard
Dependency Injection?
Hi
Many thanks for putting this repo together, it is an excellent example.
What are your thoughts on using a Dependency Injection library like tsyringe? Could 'newing up' several dependencies in your todo service lead to a lot of boilerplate setup for each handler when more abstractions are created around IO and Business Logic?
I've forked your repo, created a branch and refactored the todo service with a few tests as a basic example - https://github.com/stottle-uk/nx-serverless/tree/dependency_injection.
Any thoughts or ideas you have would be much appreciated.
Kind regards
I didn't use DI and chose pure exported functions to benefit from tree-shaking. By doing so, each lambda bundles the minimum it needs.