security: harden production configuration and routes
Run Tests on Branches / Detect Changes (push) Successful in 12s
Run Tests on Branches / Frontend Tests (push) Successful in 2m12s
Run Tests on Branches / Frontend Mobile Tests (push) Has been skipped
Run Tests on Branches / Parapharmacy API Tests (push) Successful in 2m2s
Run Tests on Branches / PIP Platform Tests (push) Has been skipped
Run Tests on Branches / Backend Tests (push) Successful in 2m8s
Run Tests on Branches / Detect Changes (push) Successful in 12s
Run Tests on Branches / Frontend Tests (push) Successful in 2m12s
Run Tests on Branches / Frontend Mobile Tests (push) Has been skipped
Run Tests on Branches / Parapharmacy API Tests (push) Successful in 2m2s
Run Tests on Branches / PIP Platform Tests (push) Has been skipped
Run Tests on Branches / Backend Tests (push) Successful in 2m8s
This commit is contained in:
@@ -53,7 +53,7 @@ const swaggerSpec = swaggerJsdoc(swaggerOptions);
|
||||
|
||||
// Middleware
|
||||
app.use(cors(config.cors));
|
||||
app.use(express.json({ limit: '10mb' }));
|
||||
app.use(express.json({ limit: '1mb' }));
|
||||
app.use(morgan('combined'));
|
||||
|
||||
// Rate limiting
|
||||
@@ -66,11 +66,13 @@ const limiter = rateLimit({
|
||||
app.use(limiter);
|
||||
|
||||
// Swagger UI
|
||||
app.use('/api/docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec, {
|
||||
explorer: true,
|
||||
customCss: '.swagger-ui .topbar { display: none }',
|
||||
customSiteTitle: 'FarmaFinder Parapharmacy API',
|
||||
}));
|
||||
if (!['production', 'test'].includes(process.env.NODE_ENV)) {
|
||||
app.use('/api/docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec, {
|
||||
explorer: true,
|
||||
customCss: '.swagger-ui .topbar { display: none }',
|
||||
customSiteTitle: 'FarmaFinder Parapharmacy API',
|
||||
}));
|
||||
}
|
||||
|
||||
// Routes
|
||||
app.use('/api/products', productsRouter);
|
||||
@@ -131,6 +133,6 @@ process.on('SIGINT', async () => {
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
start();
|
||||
if (process.env.NODE_ENV !== 'test') start();
|
||||
|
||||
export default app;
|
||||
|
||||
Reference in New Issue
Block a user