20 lines
487 B
TypeScript
20 lines
487 B
TypeScript
import { Controller, Get, UseGuards } from '@nestjs/common';
|
|
import { AppService } from './app.service';
|
|
import { JwtAuthGuard } from './auth/jwt.guard';
|
|
|
|
@Controller()
|
|
export class AppController {
|
|
constructor(private readonly appService: AppService) {}
|
|
@Get()
|
|
async getHello(): Promise<string> {
|
|
const greeting = await this.appService.getHello();
|
|
return greeting;
|
|
}
|
|
|
|
@UseGuards(JwtAuthGuard)
|
|
@Get('/protected')
|
|
async getProtected() {
|
|
return 'PROTECTED';
|
|
}
|
|
}
|