From 399f9b19171f23a23ef36c618ca47e1ffd10fe4e 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: Thu, 25 Jun 2026 02:37:27 +0530 Subject: [PATCH] fix: Vercel deployment - skip app.listen() on Vercel, fix vercel.json routes --- server.js | 10 ++++++---- vercel.json | 17 ++++++++++++----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/server.js b/server.js index 1e6e9f8..49052d4 100644 --- a/server.js +++ b/server.js @@ -259,12 +259,14 @@ app.use((req, res) => { }); // ══════════════════════════════════════════════════════════════ -// SERVER START +// SERVER START (only when running standalone, not on Vercel) // ══════════════════════════════════════════════════════════════ -app.listen(PORT, () => { - console.log(`[${new Date().toISOString()}] MiruroAPI v2.0.0 listening at ${PORT}`); -}); +if (!process.env.VERCEL) { + app.listen(PORT, () => { + console.log(`[${new Date().toISOString()}] MiruroAPI v2.1.0 listening at ${PORT}`); + }); +} module.exports = app; diff --git a/vercel.json b/vercel.json index 30202ac..4cd23e9 100644 --- a/vercel.json +++ b/vercel.json @@ -1,8 +1,15 @@ { - "functions": { - "api/index.js": { - "includeFiles": "src/**", - "maxDuration": 30 + "version": 2, + "builds": [ + { + "src": "api/index.js", + "use": "@vercel/node" } - } + ], + "routes": [ + { + "src": "/api/(.*)", + "dest": "/api/index.js" + } + ] }