security: add @nestjs/throttler — rate limiting global 60/min + search 20/min
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
import { Controller, Get, Query } from '@nestjs/common';
|
||||
import { Throttle } from '@nestjs/throttler';
|
||||
import { WorkService } from './work.service';
|
||||
|
||||
@Controller('api/works')
|
||||
export class WorkController {
|
||||
constructor(private readonly workService: WorkService) {}
|
||||
|
||||
@Throttle([{ ttl: 60000, limit: 20 }])
|
||||
@Get('search')
|
||||
async search(
|
||||
@Query('q') query: string,
|
||||
|
||||
Reference in New Issue
Block a user