Skip to content

Instantly share code, notes, and snippets.

View SadiqDev-stack's full-sized avatar

Sadiq cyber SadiqDev-stack

View GitHub Profile
@SadiqDev-stack
SadiqDev-stack / server.js
Created February 25, 2026 16:39
This is how I setup my express server , it is very modular with mb artitectures, it has security like rate limiter cors and more , it is very modular and flexible I use utilities and middlewares like authentication role access logger etc it robust error handling and it is server file for one of my large project Sadiq sharp sub fintech app, this …
import express from "express";
import cors from "cors";
import mongoose from 'mongoose';
import {templates} from "./services/mail.js";
import cookieParser from "cookie-parser"
import {dbHandler} from "./middlewares/dbhandler.js";
import errorHandler from "./middlewares/error.js"
const app = express();
const { PORT = 8080, DB_URI } = process.env;