fix: start express server listener in server/api-mongodb.js on container boot

This commit is contained in:
2026-08-10 09:25:09 +00:00
parent 447f9d3cfe
commit 50af9fb120
+13
View File
@@ -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;