improve: tell user that the WebUI is available (#631)
This commit is contained in:
parent
45cb9c6da0
commit
063adb3519
@ -13,11 +13,6 @@ import { customRouter } from "@/src/routes/custom";
|
||||
import { dynamicController } from "@/src/routes/dynamic";
|
||||
import { statsRouter } from "@/src/routes/stats";
|
||||
import { webuiRouter } from "@/src/routes/webui";
|
||||
import { connectDatabase } from "@/src/services/mongoService";
|
||||
import { registerLogFileCreationListener } from "@/src/utils/logger";
|
||||
|
||||
void registerLogFileCreationListener();
|
||||
void connectDatabase();
|
||||
|
||||
const app = express();
|
||||
|
||||
|
30
src/index.ts
30
src/index.ts
@ -7,21 +7,29 @@ import https from "https";
|
||||
import fs from "node:fs";
|
||||
import { app } from "./app";
|
||||
import { config } from "./services/configService";
|
||||
//const morgan = require("morgan");
|
||||
//const bodyParser = require("body-parser");
|
||||
import { connectDatabase } from "@/src/services/mongoService";
|
||||
import { registerLogFileCreationListener } from "@/src/utils/logger";
|
||||
|
||||
registerLogFileCreationListener();
|
||||
|
||||
void (async (): Promise<void> => {
|
||||
await connectDatabase();
|
||||
|
||||
const httpPort = config.httpPort || 80;
|
||||
const httpsPort = config.httpsPort || 443;
|
||||
const options = {
|
||||
key: fs.readFileSync("static/certs/key.pem"),
|
||||
cert: fs.readFileSync("static/certs/cert.pem")
|
||||
};
|
||||
|
||||
const httpPort = config.httpPort || 80;
|
||||
const httpsPort = config.httpsPort || 443;
|
||||
http.createServer(app).listen(httpPort, () => {
|
||||
logger.info("HTTP server started on port " + httpPort);
|
||||
https.createServer(options, app).listen(httpsPort, () => {
|
||||
logger.info("HTTPS server started on port " + httpsPort);
|
||||
|
||||
// const server = http.createServer(app).listen(80);
|
||||
http.createServer(app).listen(httpPort, () => logger.info("HTTP server started on port " + httpPort));
|
||||
const server = https.createServer(options, app);
|
||||
server.listen(httpsPort, () => logger.info("HTTPS server started on port " + httpsPort));
|
||||
|
||||
// server.keepAliveTimeout = 60 * 1000 + 1000;
|
||||
// server.headersTimeout = 60 * 1000 + 2000;
|
||||
logger.info(
|
||||
"Access the WebUI in your browser at http://localhost" + (httpPort == 80 ? "" : ":" + httpPort)
|
||||
);
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
@ -8,7 +8,7 @@ if (url === undefined) {
|
||||
throw new Error("MONGODB_URL not found. Make sure you have a .env file in the root of the project!");
|
||||
}
|
||||
|
||||
const connectDatabase = async () => {
|
||||
export const connectDatabase = async (): Promise<void> => {
|
||||
try {
|
||||
await mongoose.connect(`${url}`);
|
||||
logger.info("Connected to MongoDB");
|
||||
@ -18,5 +18,3 @@ const connectDatabase = async () => {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export { connectDatabase };
|
||||
|
Loading…
x
Reference in New Issue
Block a user