/
githubmirror
/
nest
Обзор
Документация
Войти
/
githubmirror
/
nest
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
sample/19-auth-jwt/src/auth/auth.controller.ts
28 строк
577 B
Kamil Myśliwiec
sample(19-auth): update sample to not use passport
29 мар 2023, 15:39
Не верифицирован
29 мар 2023, 15:39
4d71fe4
Код
Авторство
О чём код?
import { Body, Controller, Get, HttpCode, HttpStatus, Post, Request, } from '@nestjs/common'; import { AuthService } from './auth.service'; import { Public } from './decorators/public.decorator'; @Controller('auth') export class AuthController { constructor(private authService: AuthService) {} @Public() @HttpCode(HttpStatus.OK) @Post('login') signIn(@Body() signInDto: Record<string, any>) { return this.authService.signIn(signInDto.username, signInDto.password); } @Get('profile') getProfile(@Request() req) { return req.user; } }