From 6f75bab281964b716528bbea5de1566981df538c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=CA=9C=C9=AA=C9=B4=E1=B4=87=C9=AA=20N=E1=B4=8F=E1=B4=9C?= =?UTF-8?q?=E1=B4=A2=E1=B4=87=C9=B4?= <157171073+Shineii86@users.noreply.github.com> Date: Mon, 8 Jun 2026 18:06:29 +0530 Subject: [PATCH] fix: use process.cwd() for public dir + simplified routes - Changed publicDir to use process.cwd() for Vercel compatibility - Simplified vercel.json routes: API -> server.js, everything else -> server.js - Express.static will serve files from public/ directory --- server.js | 2 +- vercel.json | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index 1b18d2b..cf1920f 100644 --- a/server.js +++ b/server.js @@ -34,7 +34,7 @@ dotenv.config(); const app = express(); const PORT = process.env.PORT || 4444; const __filename = fileURLToPath(import.meta.url); -const publicDir = path.join(dirname(__filename), "public"); +const publicDir = path.join(process.cwd(), "public"); const allowedOrigins = process.env.ALLOWED_ORIGINS?.split(","); // ══════════════════════════════════════════════════════════════ diff --git a/vercel.json b/vercel.json index ce55256..c9bf036 100644 --- a/vercel.json +++ b/vercel.json @@ -13,7 +13,10 @@ "headers": { "Access-Control-Allow-Origin": "*" } + }, + { + "src": "/(.*)", + "dest": "server.js" } - ], - "outputDirectory": "public" + ] } \ No newline at end of file