guard creation and more

This commit is contained in:
IO
2024-06-06 20:32:46 -06:00
parent f568730942
commit 31d6f2c65d
11 changed files with 105 additions and 62 deletions
+18 -3
View File
@@ -1,5 +1,14 @@
import { Body, Controller, Post, HttpCode, HttpStatus } from '@nestjs/common';
import {
Body,
Controller,
Get,
HttpCode,
HttpStatus,
Post,
Request,
UseGuards
} from '@nestjs/common';
import { AuthGuard } from './auth.guard';
import { AuthService } from './auth.service';
@Controller('auth')
@@ -11,4 +20,10 @@ export class AuthController {
signIn(@Body() signInDto: Record<string, any>) {
return this.authService.signIn(signInDto.username, signInDto.password);
}
}
@UseGuards(AuthGuard)
@Get('profile')
getProfile(@Request() req) {
return req.user;
}
}