kugacz / nj-request-scope

Performant request scope dependency injection for NestJS framework using express server
MIT License
22 stars 7 forks source link

Any plans to implement other Spring like proxy based decorators?:) #5

Closed FrancoCorleone closed 1 year ago

FrancoCorleone commented 2 years ago

As in the title, I love what you did here. I'd have to take some more time to dig in, but from what I saw your message on SO, this should be a proper way of doing this DI, I can't believe they haven't yet introduced it in the core framework, do you observe any caveats? That being said, it could be a nice initiative to build around NestJS proper Injectables() so we could benefit from such a basic stuff like Cache, Validation etc... Let me know what you think :) Greetings

kugacz commented 2 years ago

It's nice to hear that you enjoy this solution :) Request Scope DI based on Proxy Pattern (like Spring does) is the proper way, and I also wonder why NestJS doesn't go this path. In the beginning, I was trying to use the native NestJS Request Scope mechanism, but it turned out that it was very inefficient. That was my problem to solve, so I implemented this library. Currently, I've switched back to Java, so I don't use NestJS daily and I'm not planning any other implementations. But if you are going to build any around the NejstJS solution, I would be glad to try to contribute to your project in my free time :)