debug-Mode hinzugefügt für Log in file oder Console

This commit is contained in:
klaas 2025-04-12 21:58:09 +02:00
parent 1d3e426752
commit aa5489a068
1 changed files with 13 additions and 7 deletions

20
app.js
View File

@ -7,17 +7,20 @@ const path = require("path");
const moment = require("moment");
require("dotenv").config();
const log = require("node-file-logger");
const debug = true;
const app = express();
const port = process.env.PORT;
const cors = require('cors');
const cors = require("cors");
// Konfiguration: Erlaube Frontend-Port
app.use(cors({
origin: 'http://localhost:5173',
credentials: true // Wenn du Cookies / Sessions brauchst (z.B. JWT in Cookies)
}));
app.use(
cors({
origin: "http://localhost:5173",
credentials: true, // Wenn du Cookies / Sessions brauchst (z.B. JWT in Cookies)
})
);
const options = {
timeZone: "europe/Berlin",
@ -103,6 +106,9 @@ app.use(
);
const server = app.listen(port, "0.0.0.0", () => {
console.log(`Server is running on ${process.env.HOST}:${port}/`);
log.Info(`Server is running on ${process.env.HOST}:${port}/`);
if (debug) {
console.log(`Server is running on ${process.env.HOST}:${port}/`);
} else {
log.Info(`Server is running on ${process.env.HOST}:${port}/`);
}
});