Hey, my server has two endpoints, one user facing endpoints and other admin facing endpoints and I have modules like auth, user, services, etc,. My current structure is following:
src/modules/
βββ auth
βΒ Β βββ auth.controller.ts
βΒ Β βββ auth.module.ts
βΒ Β βββ auth.service.ts
βΒ Β βββ dto
βΒ Β βββ user-login.dto.ts
βΒ Β βββ user-register.dto.ts
βββ service
βΒ Β βββ dto
βΒ Β βΒ Β βββ create-service.dto.ts
βΒ Β βΒ Β βββ update-service.dto.ts
βΒ Β βββ service.controller.spec.ts
βΒ Β βββ service.controller.ts
βΒ Β βββ service.module.ts
βΒ Β βββ service.service.spec.ts
βΒ Β βββ service.service.ts
βββ user
βββ dto
βΒ Β βββ update-user.dto.ts
βββ user.controller.ts
βββ user.module.ts
βββ user.service.ts
Each module will have user and admin API. I need advice on how do I structure my project, so that I can easily manage admin and user endpoint for each module.
I read somewhere that I can create multiple controllers and services within a module to separate logic of user and admin APIs, as follows:
βββ service
βΒ Β βββ service.controller.ts
βΒ Β βββ service-admin.controller.ts
βΒ Β βββ service.module.ts
βΒ Β βββ service.service.ts
βΒ Β βββ service-admin.service.ts
But I am not sure if this is the correct way or not.