File size: 708 Bytes
bd9f61b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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);
  }
}