Created
June 8, 2020 09:13
-
-
Save jacobdo2/024d9bc0c91510682023c4a69397739f to your computer and use it in GitHub Desktop.
AuthController
This file contains hidden or 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