From 50af9fb1206c9875dee4c375d57677f51d51c528 Mon Sep 17 00:00:00 2001 From: Sergio Nicolas Lavaise Date: Mon, 10 Aug 2026 09:25:09 +0000 Subject: [PATCH] fix: start express server listener in server/api-mongodb.js on container boot --- server/api-mongodb.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/server/api-mongodb.js b/server/api-mongodb.js index be04975..25f9151 100644 --- a/server/api-mongodb.js +++ b/server/api-mongodb.js @@ -725,5 +725,18 @@ app.put('/api/auth/update-email', async (req, res) => { const PORT = process.env.PORT || 4000; const HOST = process.env.HOST || '0.0.0.0'; +if (import.meta.url === `file://${process.argv[1]}`) { + initDb() + .then(() => { + app.listen(PORT, HOST, () => { + console.log(`Backend API running on http://${HOST}:${PORT}`); + }); + }) + .catch((err) => { + console.error('Failed to initialize MongoDB in standalone mode:', err); + process.exit(1); + }); +} + export { initDb }; export default app;