2026-07-13 17:49:01 +05:30
|
|
|
import './src/shared/config/env.js';
|
2026-06-30 11:40:07 +05:30
|
|
|
import http from 'http';
|
|
|
|
|
import app from './app.js';
|
|
|
|
|
import { connectDatabase } from './src/shared/database/connection.js';
|
|
|
|
|
import { SocketService } from './src/shared/services/socket.service.js';
|
|
|
|
|
|
|
|
|
|
const PORT = process.env.PORT || 5000;
|
|
|
|
|
|
|
|
|
|
async function bootstrap() {
|
|
|
|
|
try {
|
|
|
|
|
// Connect database
|
|
|
|
|
await connectDatabase();
|
|
|
|
|
|
|
|
|
|
// Create HTTP Server
|
|
|
|
|
const server = http.createServer(app);
|
|
|
|
|
|
|
|
|
|
// Initialize Socket.io service
|
|
|
|
|
SocketService.init(server);
|
|
|
|
|
|
|
|
|
|
server.listen(PORT, () => {
|
|
|
|
|
console.log(`==================================================`);
|
|
|
|
|
console.log(` Enterprise PIM Backend Server Started `);
|
|
|
|
|
console.log(` Port: ${PORT} `);
|
|
|
|
|
console.log(` Env: ${process.env.NODE_ENV || 'development'} `);
|
|
|
|
|
console.log(` Docs: http://localhost:${PORT}/api/docs `);
|
|
|
|
|
console.log(`==================================================`);
|
|
|
|
|
});
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error('Bootstrap error occurred:', error);
|
|
|
|
|
process.exit(1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bootstrap();
|