Are there any good dependency injection libraries available/compatible with bun? #3273
Unanswered
jdgriffith
asked this question in
Q&A
Replies: 2 comments 6 replies
-
I try using typedi and it work, but you need to use example codeimport 'reflect-metadata';
import { Service, Container } from 'typedi';
@Service()
class AppRepository {
foo = () => {
console.log('bar');
};
}
@Service()
class AppService {
baz = () => {
Container.get(AppRepository).foo();
};
}
new AppService().baz(); |
Beta Was this translation helpful? Give feedback.
1 reply
-
Currently trying this in Elysia and it doesn't work, but using it as stated in that example w/o elysia, works fine Ideas? |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm coming from nestjs and am comfortable with their dependency injection (DI) or inversion of control, which works incredibly well. I have decent sized codebases with different modules and would like to keep some of the same structure if I port the code to the bun runtime. Are there any options for someone like me?
P.S. I don't need http capability atm, only need DI.
Beta Was this translation helpful? Give feedback.
All reactions