Commit inicial - upload de todos os arquivos da pasta
This commit is contained in:
20
src/app.controller.ts
Normal file
20
src/app.controller.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { Controller, Get, Req, UseGuards } from '@nestjs/common';
|
||||
import type { Request } from 'express';
|
||||
import { JwtAuthGuard } from './config/auth/jwt-auth.guard';
|
||||
import { AppService } from './app.service';
|
||||
|
||||
@Controller()
|
||||
export class AppController {
|
||||
constructor(private readonly appService: AppService) {}
|
||||
|
||||
@Get()
|
||||
getHello(): string {
|
||||
return this.appService.getHello();
|
||||
}
|
||||
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Get('protected')
|
||||
getProtected(@Req() req: Request): { message: string; user: unknown } {
|
||||
return { message: 'authorized', user: req.user };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user