❓Imports by interface
Implementation flexibility and prevent circular dependency.
Imports by interface provide greater implementation flexibility and prevent circular dependency. With interface implementation, it's much easier to test our module, as we can create services that implement this interface.
Understand how it works.
Using Nest
, you can implement interfaces instead of the service, and with that, the service starts to implement this interface, for example.
cats.interface.ts
cats.service.ts
To inject our service into another, it would look like this.
app.module.ts
app.service.ts
Last updated