Modernization Project Complete. Updated to latest versions of frameworks.
This commit is contained in:
@@ -1,36 +1,45 @@
|
||||
/**
|
||||
* @ai-summary Application entry point
|
||||
* @ai-context Starts the Express server with all feature capsules
|
||||
* @ai-context Starts the Fastify server with all feature capsules
|
||||
*/
|
||||
import { app } from './app';
|
||||
import { buildApp } from './app';
|
||||
import { env } from './core/config/environment';
|
||||
import { logger } from './core/logging/logger';
|
||||
|
||||
const PORT = env.PORT || 3001;
|
||||
|
||||
const server = app.listen(PORT, () => {
|
||||
logger.info(`MotoVaultPro backend running`, {
|
||||
port: PORT,
|
||||
environment: env.NODE_ENV,
|
||||
nodeVersion: process.version,
|
||||
});
|
||||
});
|
||||
async function start() {
|
||||
try {
|
||||
const app = await buildApp();
|
||||
|
||||
await app.listen({
|
||||
port: PORT,
|
||||
host: '0.0.0.0'
|
||||
});
|
||||
|
||||
logger.info(`MotoVaultPro backend running`, {
|
||||
port: PORT,
|
||||
environment: env.NODE_ENV,
|
||||
nodeVersion: process.version,
|
||||
framework: 'Fastify'
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error('Failed to start server', { error });
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
start();
|
||||
|
||||
// Graceful shutdown
|
||||
process.on('SIGTERM', () => {
|
||||
logger.info('SIGTERM received, shutting down gracefully');
|
||||
server.close(() => {
|
||||
logger.info('Server closed');
|
||||
process.exit(0);
|
||||
});
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
logger.info('SIGINT received, shutting down gracefully');
|
||||
server.close(() => {
|
||||
logger.info('Server closed');
|
||||
process.exit(0);
|
||||
});
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
// Handle uncaught exceptions
|
||||
|
||||
Reference in New Issue
Block a user