kodelyx-backend / src /auth /auth.controller.ts
kodelyx's picture
Deploy NestJS backend with Prisma SQLite support
bd9f61b
Raw
History Blame Contribute Delete
708 Bytes
import { Controller, Post, Body, Res, HttpStatus } from '@nestjs/common';
import { AuthService } from './auth.service';
import { SignupDto, SigninDto } from './dto';
import { Response } from 'express';
@Controller('api/auth')
export class AuthController {
constructor(private readonly authService: AuthService) {}
@Post('signup')
async signup(@Body() dto: SignupDto, @Res() res: Response) {
const result = await this.authService.signup(dto);
return res.status(HttpStatus.CREATED).json(result);
}
@Post('signin')
async signin(@Body() dto: SigninDto, @Res() res: Response) {
const result = await this.authService.signin(dto);
return res.status(HttpStatus.OK).json(result);
}
}