Sindbad~EG File Manager
import { config } from "dotenv";
config();
import express from "express";
const app = express();
import serverRoutes from "./routes/serverRoutes";
import globalErrorHandler from "./controllers/errorHandler";
import loader from "./loaders/index";
import routeNotHandler from "./middlewares/routeNotFound";
let { middlewareLoader, excludeJwtAuthRoutes, staticRoutesLoader } = loader;
//App middlewares
middlewareLoader(app);
//load static routes
staticRoutesLoader(app);
// Global JWT Authentication Middleware
app.use(excludeJwtAuthRoutes(["/auth/login"]));
// Load Routes
app.use("/", serverRoutes);
// some kind of middleWare for express to undefined routes to send custom json || html
app.all("*", routeNotHandler);
// global middleWare error handler for operational errors
app.use(globalErrorHandler);
export default app;
// updateDbCollections();
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists