app.controller.ts 486 B

12345678910111213141516171819
  1. import { Controller, Request, Post, UseGuards, Get } from '@nestjs/common';
  2. import { AuthGuard } from '@nestjs/passport';
  3. import { AuthService } from './auth/auth.service';
  4. @Controller()
  5. export class AppController {
  6. constructor(private readonly authService: AuthService) {}
  7. @UseGuards(AuthGuard('local'))
  8. @Post('login')
  9. async login(@Request() req) {
  10. return this.authService.login(req.user);
  11. }
  12. @Get('healthy')
  13. async checkServer() {
  14. return { status: 200 };
  15. }
  16. }