So this is how im organising my services files, insted of placing all route logic into one auth.service.ts file, i decided to place all route login to their separate file so this is what my module structure:
So is this a valid way to organise? or there some another ways to achieve this?
auth/ -> Dir
services/ -> Dir
sign-in.service.ts
sign-up.service.ts
auth.controller.ts
auth.module.ts
import { Body, Controller, Post } from '@nestjs/common';
import { SignUpService } from './services/sign-up.service';
import { SignUpDto } from './dtos/sign-up.dto';
import { SignInService } from './services/sign-in.service';
@Controller('auth')
export class AuthController {
constructor(
private readonly signUpService: SignUpService,
private readonly signInService: SignInService,
// Other services for each routes
) {}
@Post('sign-up')
async signUp(@Body() dto: SignUpDto): Promise<unknown> {
return this.signUpService.signUp(dto);
}
@Post('sign-in')
async signIn(): Promise<unknown> {
return this.signInService.signIn();
}
}