> Gandalf The Grey will protect your NestJS application from unauthorized users, xss, sqli, nosqli attacks and more.
AuthGuard
import { Controller, Get, HttpCode, UseGuards } from '@nestjs/common'
import { YouShallNotPass } from '@tigdevs/thegrey'
import { AppService } from './app.service'
@Controller('test')
export class AppController {
constructor(private readonly appService: AppService) {}
@Get('users')
@HttpCode(200)
@UseGuards(YouShallNotPass)
public listUsers(): Array<Record<string, unknown>> {
return this.appService.listUsers()
}
}