0

I'm trying to fully understand how modules DI works and I'm struggling with one thing.

I have sample app:

-- API MODULE

  • all controllers here

-- USER MODULE

  • APPLICATION MODULE
  • DOMAIN MODULE
  • INFRASTRUCTURE MODULE

-- CARD MODULE

  • APPLICATION MODULE
  • DOMAIN MODULE
  • INFRASTRUCTURE MODULE

-- GENERAL APP MODULE

Two things:

  1. I want to create interface in USER MODULE to be implemented in INFRASTRUCTURE MODULE. But I don't want to import infra into domain. It makes no sense. Instead I want to bind it somewhere else but can't figure out how to make it work. It complains that USER DOMAIN MODULE can't see implementation of interface (through symbol)
  2. Second thing is - I don't want to mix modules. So if I need to access USER from CARD I don't want to simply import whole user domain. I want to create some interface on CARD site and then add some "client implementation" on user site and bind it somewhere. But I have the same complaints as in previous example.

So where should I bind those "cross modules dependencies"?

1
  • You might want to look into this: docs.nestjs.com/fundamentals/… So you might need to specify the implementation inside the definition of UserModule and map the interface to something. Commented Nov 2 at 22:25

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.