auth.controller.ts
920 Bytes
import { Controller, Request, Post, UseGuards } from '@nestjs/common';
import { AuthService } from './auth.service';
import { AuthGuard } from '@nestjs/passport';
@Controller('auth')
export class AuthController {
constructor(private readonly authService: AuthService) { }
// @Post()
// create(@Body() createAuthDto: CreateAuthDto) {
// return this.authService.create(createAuthDto);
// }
@UseGuards(AuthGuard('local'))
@Post('login')
async login(@Request() req) {
return this.authService.login(req.user);
}
// @Get(':id')
// findOne(@Param('id') id: string) {
// return this.authService.findOne(+id);
// }
// @Patch(':id')
// update(@Param('id') id: string, @Body() updateAuthDto: UpdateAuthDto) {
// return this.authService.update(+id, updateAuthDto);
// }
// @Delete(':id')
// remove(@Param('id') id: string) {
// return this.authService.remove(+id);
// }
}