Tra
Tra

Reputation: 135

NestJS: If I want to activate service B from service A should I do this directly or call on Controller B?

Hi I'm finishing up my first api CRUD so not sure regarding this one aspect of it.

If I have the following:

Controller A Service A

Controller B Service B

I want to activate a function in Service B. Should I call an HTTP request to Controller B?

HTTP request would also add in a DTO (Not sure if another DTO is needed if I'm calling it directly from services.

Thanks!

Upvotes: 0

Views: 620

Answers (1)

Daniel Tran
Daniel Tran

Reputation: 6169

Service should not be tied to Controller but a business logic instead.

You can call the Service B directly from service A

Upvotes: 3

Related Questions