abstracted server start logging

This commit is contained in:
William Welling
2017-07-19 11:29:38 -05:00
parent 9352440db4
commit bd76342e85
2 changed files with 12 additions and 4 deletions

View File

@@ -81,12 +81,16 @@ ROUTES.forEach((route: string) => {
}); });
}); });
function serverStarted() {
console.log(`[${new Date().toTimeString()}] Listening at ${ENV_CONFIG.ui.baseUrl}`);
}
function createHttpsServer(keys) { function createHttpsServer(keys) {
https.createServer({ https.createServer({
key: keys.serviceKey, key: keys.serviceKey,
cert: keys.certificate cert: keys.certificate
}, app).listen(port, ENV_CONFIG.ui.host, () => { }, app).listen(port, ENV_CONFIG.ui.host, () => {
console.log(`Listening at ${ENV_CONFIG.ui.baseUrl}`); serverStarted();
}); });
} }
@@ -123,6 +127,6 @@ if (ENV_CONFIG.ui.ssl) {
} }
} else { } else {
app.listen(port, ENV_CONFIG.ui.host, () => { app.listen(port, ENV_CONFIG.ui.host, () => {
console.log(`[${new Date().toTimeString()}] Listening at ${ENV_CONFIG.ui.baseUrl}`); serverStarted();
}); });
} }

View File

@@ -69,12 +69,16 @@ ROUTES.forEach((route: string) => {
}); });
}); });
function serverStarted() {
console.log(`[${new Date().toTimeString()}] Listening at ${ENV_CONFIG.ui.baseUrl}`);
}
function createHttpsServer(keys) { function createHttpsServer(keys) {
https.createServer({ https.createServer({
key: keys.serviceKey, key: keys.serviceKey,
cert: keys.certificate cert: keys.certificate
}, app).listen(port, ENV_CONFIG.ui.host, () => { }, app).listen(port, ENV_CONFIG.ui.host, () => {
console.log(`Listening at ${ENV_CONFIG.ui.baseUrl}`); serverStarted();
}); });
} }
@@ -111,6 +115,6 @@ if (ENV_CONFIG.ui.ssl) {
} }
} else { } else {
app.listen(port, ENV_CONFIG.ui.host, () => { app.listen(port, ENV_CONFIG.ui.host, () => {
console.log(`[${new Date().toTimeString()}] Listening at ${ENV_CONFIG.ui.baseUrl}`); serverStarted();
}); });
} }