Created
October 24, 2022 12:38
-
-
Save akkonrad/c40acb4ed27979c07b99e536fa71008c to your computer and use it in GitHub Desktop.
auth/auth.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { BadRequestException, Body, Controller, Post } from '@nestjs/common'; | |
import { AuthService } from './auth.service'; | |
@Controller('auth') | |
export class AuthController { | |
constructor(private readonly authService: AuthService) {} | |
@Post('login') | |
async login(@Body() authenticateRequest: { name: string; password: string }) { | |
try { | |
return await this.authService.authenticateUser(authenticateRequest); | |
} catch (e) { | |
throw new BadRequestException(e.message); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment