-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.js
More file actions
30 lines (25 loc) · 718 Bytes
/
Copy pathindex.js
File metadata and controls
30 lines (25 loc) · 718 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
require('dotenv').config();
const app = require('./app');
const logger = require('./logger');
const {
pollEmailQueue,
pollInviteQueue,
pollBarterNotification,
} = require('./src/services/emailQueueProcessor');
const PORT = process.env.PORT;
// Start polling the Redis queues
pollEmailQueue();
pollInviteQueue();
pollBarterNotification();
// Start the server
const server = app.listen(PORT, () => {
logger.info(`Server is running on port: ${PORT}`);
});
// Gracefully close the server on SIGINT (Ctrl+C)
process.on('SIGINT', () => {
logger.info(`SIGINT signal received, closing the server...`);
server.close(() => {
console.log(`Closed the HTTP server gracefully.`);
process.exit(1);
});
});