modified: backend/src/server.ts
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import express, { Express, Request, Response } from 'express';
|
||||
import cors from 'cors';
|
||||
import helmet from 'helmet';
|
||||
import rateLimit from 'express-rate-limit';
|
||||
// import rateLimit from 'express-rate-limit';
|
||||
import swaggerUi from 'swagger-ui-express';
|
||||
import path from 'path';
|
||||
import { createProxyMiddleware } from 'http-proxy-middleware';
|
||||
@@ -37,16 +37,16 @@ app.use(cors());
|
||||
app.use(express.json());
|
||||
app.use(express.urlencoded({ extended: true }));
|
||||
|
||||
// Rate limiting
|
||||
const limiter = rateLimit({
|
||||
windowMs: config.rateLimit.windowMs,
|
||||
max: config.rateLimit.maxRequests,
|
||||
message: 'Too many requests from this IP, please try again later.',
|
||||
validate: { trustProxy: false }, // Отключаем валидацию trust proxy
|
||||
standardHeaders: true,
|
||||
legacyHeaders: false,
|
||||
});
|
||||
app.use('/api/', limiter);
|
||||
// Rate limiting - DISABLED
|
||||
// const limiter = rateLimit({
|
||||
// windowMs: config.rateLimit.windowMs,
|
||||
// max: config.rateLimit.maxRequests,
|
||||
// message: 'Too many requests from this IP, please try again later.',
|
||||
// validate: { trustProxy: false }, // Отключаем валидацию trust proxy
|
||||
// standardHeaders: true,
|
||||
// legacyHeaders: false,
|
||||
// });
|
||||
// app.use('/api/', limiter);
|
||||
|
||||
// Dynamic Swagger documentation
|
||||
app.get('/api-docs/swagger.json', async (_req, res) => {
|
||||
|
||||
Reference in New Issue
Block a user