Spaces:
Running
Running
Commit ·
08512dc
1
Parent(s): 5961dfd
feat(security): add rate limiting to protect API endpoints
Browse filesIntroduce ThrottlerModule to enforce rate limits of 20 requests per minute per IP. This prevents abuse and ensures fair usage of the API resources.
- README.md +1 -1
- src/app.module.ts +8 -0
README.md
CHANGED
|
@@ -18,4 +18,4 @@ It handles:
|
|
| 18 |
|
| 19 |
## Monitoring
|
| 20 |
- **Health Check**: `https://huggingface.co/spaces/Auspicious14/MaternAlert/api/v1/health`
|
| 21 |
-
- **Logs**: View the "Logs" tab in this Space to see cron job execution.
|
|
|
|
| 18 |
|
| 19 |
## Monitoring
|
| 20 |
- **Health Check**: `https://huggingface.co/spaces/Auspicious14/MaternAlert/api/v1/health`
|
| 21 |
+
- **Logs**: View the "Logs" tab in this Space to see cron job execution.
|
src/app.module.ts
CHANGED
|
@@ -26,6 +26,14 @@ import { HealthController } from "./health.controller";
|
|
| 26 |
// Scheduling
|
| 27 |
ScheduleModule.forRoot(),
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
// Database (Prisma) - Global module
|
| 30 |
DatabaseModule,
|
| 31 |
|
|
|
|
| 26 |
// Scheduling
|
| 27 |
ScheduleModule.forRoot(),
|
| 28 |
|
| 29 |
+
// Throttling
|
| 30 |
+
ThrottlerModule.forRoot([
|
| 31 |
+
{
|
| 32 |
+
ttl: 60000,
|
| 33 |
+
limit: 20,
|
| 34 |
+
},
|
| 35 |
+
]),
|
| 36 |
+
|
| 37 |
// Database (Prisma) - Global module
|
| 38 |
DatabaseModule,
|
| 39 |
|