improve: logging during startup sequence (#244)
This commit is contained in:
parent
ef96946fe4
commit
c911fd77f1
@ -1,8 +1,11 @@
|
||||
import { logger } from "./utils/logger";
|
||||
|
||||
logger.info("Starting up...");
|
||||
|
||||
import http from "http";
|
||||
import https from "https";
|
||||
import fs from "node:fs";
|
||||
import { app } from "./app";
|
||||
import { logger } from "./utils/logger";
|
||||
import { config } from "./services/configService";
|
||||
//const morgan = require("morgan");
|
||||
//const bodyParser = require("body-parser");
|
||||
@ -17,10 +20,10 @@ const httpPort = config.httpPort || 80;
|
||||
const httpsPort = config.httpsPort || 443;
|
||||
|
||||
// const server = http.createServer(app).listen(80);
|
||||
http.createServer(app).listen(httpPort, () => logger.info("cache server started on port " + httpPort));
|
||||
http.createServer(app).listen(httpPort, () => logger.info("HTTP server started on port " + httpPort));
|
||||
const server = https
|
||||
.createServer(options, app)
|
||||
.listen(httpsPort, () => logger.info("game server started on port " + httpsPort));
|
||||
.listen(httpsPort, () => logger.info("HTTPS server started on port " + httpsPort));
|
||||
|
||||
// server.keepAliveTimeout = 60 * 1000 + 1000;
|
||||
// server.headersTimeout = 60 * 1000 + 2000;
|
||||
|
@ -11,10 +11,10 @@ if (url === undefined) {
|
||||
const connectDatabase = async () => {
|
||||
try {
|
||||
await mongoose.connect(`${url}`);
|
||||
logger.info("connected to MongoDB");
|
||||
logger.info("Connected to MongoDB");
|
||||
} catch (error: unknown) {
|
||||
if (error instanceof Error) {
|
||||
logger.error(`error connecting to MongoDB ${error.message}`);
|
||||
logger.error(`Error connecting to MongoDB ${error.message}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user