♻️ refactor(account, order, plan, profile, support, email): restructure application modules and enhance error handling

Updated Docker configuration, refactored middleware for improved error handling, and restructured account, order, plan, profile, and support modules, including their routes, services, and validations. Enhanced email processing queues and utilities for token generation, pagination, and response management to streamline the application architecture and enhance maintainability.
This commit is contained in:
abumahid
2026-04-21 03:12:39 +06:00
parent c881efea0f
commit 0f7af70b90
94 changed files with 2593 additions and 127 deletions
Vendored
+37
View File
@@ -0,0 +1,37 @@
import cookieParser from 'cookie-parser';
import cors from 'cors';
import express from 'express';
import swaggerJSDoc from 'swagger-jsdoc';
import swaggerUi from "swagger-ui-express";
import globalErrorHandler from './app/middlewares/global_error_handler.js';
import notFound from './app/middlewares/not_found_api.js';
import appRouter from './routes.js';
import { swaggerOptions } from './swaggerOptions.js';
// define app
const app = express();
const swaggerSpec = swaggerJSDoc(swaggerOptions);
app.use("/docs", swaggerUi.serve, swaggerUi.setup(swaggerSpec));
// middleware
app.use(cors({
origin: ["http://localhost:3000"],
methods: ["GET", "POST", "PATCH", "DELETE", "PUT"],
credentials: true
}));
app.use(express.json({ limit: "100mb" }));
app.use(express.raw());
app.use(cookieParser());
app.use(express.urlencoded({ extended: true }));
app.use("/api", appRouter);
// stating point
app.get('/', (req, res) => {
res.status(200).json({
status: 'success',
message: 'Server is running successful !!',
data: null,
});
});
// global error handler
app.use(globalErrorHandler);
app.use(notFound);
// export app
export default app;