-
-
Notifications
You must be signed in to change notification settings - Fork 141
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
Hi. I was trying the other day to use the new version of the framework to achieve something like Spring Boot does in Java with with it's IOC Container, and I noticed that website lacks a little more information about this. I wanted to write something like:
export default interface FooRepositoryInterface {
findAll(): Promise<Foo>
}export default class FooRepository implements FooRepositoryInterface{
findAll(): Promise<Foo> {
// Implementation
}
}export default interface FooServiceInterface {
list(): Promise<Foo>
}export default class FooService implements FooServiceInterface {
constructor(public FooRepositoryInterface repository) {}
list(): Promise<Foo> {
return repository.findAll()
}
}export default class FooController {
constructor(public FooServiceInterface service) {}
index() {
service.list()
}
}It is possible to achieve this kind of behavior with the current version of the framework? If it is, could you guys provide me some examples or guides in how to register the dependencies on the IOC container correctly? I tried to register the classes on the provider but I could achieve the result I wanted.
Thanks in advance.
hmartiins, RodolfoSilva, MrAvantiC, brkn, qrhfz and 1 more
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation