@bunito/container
v0.0.27
Published
Dependency injection container with modules, providers, scopes, and lifecycle hooks.
Maintainers
Readme
@bunito/container
Dependency injection container for bunito.
It provides modules, providers, scopes, injections, indexed extensions, request contexts, and provider lifecycle hooks.
Installation 📦
bun add @bunito/containerUsage ✨
import { Container, Module, Provider } from '@bunito/container';
@Provider()
class HelloService {
sayHello(): string {
return 'Hello from the container';
}
}
@Module({
providers: [HelloService],
})
class AppModule {}
const container = new Container(AppModule);
const hello = await container.resolveProvider(HelloService);
hello.sayHello();License
MIT
