-
Notifications
You must be signed in to change notification settings - Fork 47
/
index.js
19 lines (16 loc) · 618 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const { server, config } = require("./server/app");
server.listen({ host: config.listen.ip, port: config.listen.port });
// eslint-disable-next-line no-console
console.log(`serverMmon service listening on http://${config.listen.ip}:${config.listen.port}`);
server.on("error", (err) => {
if (err.code === "EADDRINUSE") {
config.listen.port += 1;
console.warn(`serverMmon in use, retrying on port ${config.listen.port}`);
setTimeout(() => {
server.listen(config.listen.port);
}, 250);
} else {
// eslint-disable-next-line no-console
console.log(`serverMmon server.listen ERROR: ${err.code}`);
}
});