nx-examples icon indicating copy to clipboard operation
nx-examples copied to clipboard

Question: what is the purpose of different generated lib files?

Open zachgoll opened this issue 4 years ago • 0 comments

I am a first time user of nx, and so far, really like it. I am starting to utilize libraries with my NestJS application, and had a question on the intended purpose of specific file. Consider the following generation command:

nx g @nrwl/nest:library --directory=training/api --name=user --controller=true --service=true --tags=app:api

This creates the following lib files (among others):

1. libs/training/api/user/src/lib/training-api-user.controller.ts
2. libs/training/api/user/src/lib/training-api-user.module.ts
3. libs/training/api/user/src/lib/training-api-user.service.ts
4. libs/training/api/user/src/lib/training-api-user.ts

I think it is pretty clear what the purpose of files 1-3 are. Inject the service into the module, import the controller into the module, and utilize the service for controller-related functionality and data access.

But what is file 4 intended to be used for? I find myself leaving this blank more often than not, but given that it was auto-generated, I'm assuming it has an intended use?

Thanks!

zachgoll avatar Mar 26 '20 11:03 zachgoll