Files
ipd-shomalhospital-upload-s…/config/init.js
2026-03-26 08:17:49 +03:30

24 lines
910 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const {default: rateLimit} = require("express-rate-limit");
const path = require("path");
require("dotenv").config();
module.exports = {
PORT: process.env.PORT || 4000,
JWT_SECRET:
process.env.JWT_SECRET || "dasdG23qewqe1234441fFGfdhdghnnbCCZXQSDQWEweqwe",
STORAGE_PATH: path.resolve(__dirname, "../uploads"),
MAX_FILE_SIZE: 5 * 1024 * 1024, // 5MB
ALLOWED_FILE_TYPES: ["image/jpeg", "image/png", "image/webp"], // نوع‌های مجاز
limiter: rateLimit({
windowMs: 5 * 60 * 1000, // 5 دقیقه
max: 30,
standardHeaders: true, // Return rate limit info in `RateLimit-*` headers
legacyHeaders: false, // Disable the `X-RateLimit-*` headers
handler: (req, res) => {
res.status(500).json({
status: 500,
message: "تعداد درخواست ها بیش تر از حد مجاز، در فرصتی دیگر تلاش کنید",
});
},
}),
};