Files

25 lines
662 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'use strict';
const { uygulamaOlustur } = require('./app');
const { logger } = require('./lib/logger');
const PORT = Number(process.env.PORT) || 4700;
const HOST = process.env.HOST || '127.0.0.1';
const app = uygulamaOlustur();
const sunucu = app.listen(PORT, HOST, () => {
logger.info(`Zümrüt Kuyumculuk sitesi ayakta → http://${HOST}:${PORT}`);
});
// Düzgün kapanış (test/CI ortamında da bozmaz)
function kapat(sinyal) {
logger.info(`${sinyal} alındı, sunucu kapatılıyor...`);
sunucu.close(() => process.exit(0));
}
process.on('SIGINT', () => kapat('SIGINT'));
process.on('SIGTERM', () => kapat('SIGTERM'));
module.exports = sunucu;