Skip to content

Instantly share code, notes, and snippets.

@Vatsalya-singhi
Created March 27, 2025 18:45
Show Gist options
  • Save Vatsalya-singhi/93e2c5b6d08b5b53295a9748c50ebecd to your computer and use it in GitHub Desktop.
Save Vatsalya-singhi/93e2c5b6d08b5b53295a9748c50ebecd to your computer and use it in GitHub Desktop.
import { Controller, Get, UseGuards } from '@nestjs/common';
import { AuthGuard } from './auth.guard';
import { RoleGuard } from './role.guard';
@Controller('admin')
export class AdminController {
@Get()
@UseGuards(AuthGuard, new RoleGuard('admin')) // applying mulitple guards
findAll() {
return { message: 'Admin dashboard' };
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment