-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.js
19 lines (15 loc) · 634 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require('dotenv').config({ silent: true });
const mongoose = require('mongoose');
const env = require('./src/env-vars');
const { app } = require('./src/server');
const logger = require('./src/logger');
mongoose.Promise = Promise;
const mongooseConnectionErrorHandler = require('./src/db/mongoose-connection-error-handler');
mongooseConnectionErrorHandler(logger, [mongoose.connection]);
const server = app.listen(env.PORT, () => {
logger.info(`Listening on port ${env.PORT} with context route of /service-registry`);
});
process.on('SIGTERM', () => {
logger.info('Shutting down...');
server.close(() => app.shutdown());
});