From aa5489a0685b290ac1eb76e8c4cbcb01440fc720 Mon Sep 17 00:00:00 2001 From: klaas <klaas@boergmann.it> Date: Sat, 12 Apr 2025 21:58:09 +0200 Subject: [PATCH] =?UTF-8?q?debug-Mode=20hinzugef=C3=BCgt=20f=C3=BCr=20Log?= =?UTF-8?q?=20in=20file=20oder=20Console?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/app.js b/app.js index 6faeaad..31e3ec8 100644 --- a/app.js +++ b/app.js @@ -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}/`); + } });