You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tryFullStack/backend/src/auth/auth.controller.ts

23 lines
850 B

3 weeks ago
import { Body, Controller, Post } from '@nestjs/common';
import { AuthService } from './auth.service';
import { CreateUserDto } from 'src/users/dto/create-user.dto';
import { LoginUserDto } from 'src/auth/dto/login-user.dto';
2 weeks ago
import { SuccessResponseDto } from 'src/common/dto/sucees-response.dto';
3 weeks ago
@Controller('auth')
export class AuthController {
constructor(private readonly authService: AuthService) {}
@Post('signup')
2 weeks ago
async signup(@Body() dto: CreateUserDto): Promise<SuccessResponseDto> {
const user = await this.authService.signup(dto);
return SuccessResponseDto.of(user);
3 weeks ago
}
@Post('login')
2 weeks ago
async login(@Body() dto: LoginUserDto): Promise<SuccessResponseDto> {
const loginUser = await this.authService.login(dto);
return SuccessResponseDto.of(loginUser);
3 weeks ago
}
}