fix: start express server listener in server/api-mongodb.js on container boot
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user