2024-05-30 13:33:49 +02:00
|
|
|
import { logger } from "./utils/logger";
|
|
|
|
|
|
|
|
logger.info("Starting up...");
|
|
|
|
|
2023-05-19 15:22:48 -03:00
|
|
|
import http from "http";
|
|
|
|
import https from "https";
|
|
|
|
import fs from "node:fs";
|
|
|
|
import { app } from "./app";
|
2024-05-22 23:32:11 +02:00
|
|
|
import { config } from "./services/configService";
|
2023-05-19 15:22:48 -03:00
|
|
|
//const morgan = require("morgan");
|
|
|
|
//const bodyParser = require("body-parser");
|
|
|
|
|
|
|
|
const options = {
|
2023-05-23 20:42:06 -04:00
|
|
|
key: fs.readFileSync("static/certs/key.pem"),
|
2024-05-31 14:17:39 +02:00
|
|
|
cert: fs.readFileSync("static/certs/cert.pem")
|
2023-05-19 15:22:48 -03:00
|
|
|
};
|
|
|
|
|
2024-05-22 23:32:11 +02:00
|
|
|
const httpPort = config.httpPort || 80;
|
|
|
|
const httpsPort = config.httpsPort || 443;
|
|
|
|
|
2023-05-19 15:22:48 -03:00
|
|
|
// const server = http.createServer(app).listen(80);
|
2024-05-30 13:33:49 +02:00
|
|
|
http.createServer(app).listen(httpPort, () => logger.info("HTTP server started on port " + httpPort));
|
2024-06-01 13:03:27 +02:00
|
|
|
const server = https.createServer(options, app);
|
|
|
|
server.listen(httpsPort, () => logger.info("HTTPS server started on port " + httpsPort));
|
2023-05-19 15:22:48 -03:00
|
|
|
|
|
|
|
// server.keepAliveTimeout = 60 * 1000 + 1000;
|
|
|
|
// server.headersTimeout = 60 * 1000 + 2000;
|