Skn0tt / nextjs-nestjs-integration-example

https://nextjs-nestjs-integration-example.now.sh
156 stars 36 forks source link

Dependency Injection #5

Closed elendirx closed 4 years ago

elendirx commented 4 years ago

Thank you for this awesome example. I wonder if you succeeded in using NestJs dependency injection. I'm trying to inject some services into a controller, but it ends up being undefined. This is just a question, feel free to close this issue. Thanks!

elendirx commented 4 years ago

Solved. The problem is that Babel deletes metadata. I was able to make it work thanks to https://github.com/leonardfactory/babel-plugin-transform-typescript-metadata.

Skn0tt commented 4 years ago

I always needed to explicitly add decorators for DI to work, great to see this can be fixed :D

szabolcs-szilagyi commented 3 years ago

ah this is an awesome fix/tip, was already thinking why do I have to do the DI "manually". Should have read this issue earlier. Think it would be awesome to have this in the sample app. :)

Skn0tt commented 3 years ago

Think it would be awesome to have this in the sample app. :)

Feel free to open a PR!