debug-Mode hinzugefügt für Log in file oder Console
This commit is contained in:
parent
1d3e426752
commit
aa5489a068
20
app.js
20
app.js
|
@ -7,17 +7,20 @@ const path = require("path");
|
||||||
const moment = require("moment");
|
const moment = require("moment");
|
||||||
require("dotenv").config();
|
require("dotenv").config();
|
||||||
const log = require("node-file-logger");
|
const log = require("node-file-logger");
|
||||||
|
const debug = true;
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const port = process.env.PORT;
|
const port = process.env.PORT;
|
||||||
|
|
||||||
const cors = require('cors');
|
const cors = require("cors");
|
||||||
|
|
||||||
// Konfiguration: Erlaube Frontend-Port
|
// Konfiguration: Erlaube Frontend-Port
|
||||||
app.use(cors({
|
app.use(
|
||||||
origin: 'http://localhost:5173',
|
cors({
|
||||||
credentials: true // Wenn du Cookies / Sessions brauchst (z.B. JWT in Cookies)
|
origin: "http://localhost:5173",
|
||||||
}));
|
credentials: true, // Wenn du Cookies / Sessions brauchst (z.B. JWT in Cookies)
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
timeZone: "europe/Berlin",
|
timeZone: "europe/Berlin",
|
||||||
|
@ -103,6 +106,9 @@ app.use(
|
||||||
);
|
);
|
||||||
|
|
||||||
const server = app.listen(port, "0.0.0.0", () => {
|
const server = app.listen(port, "0.0.0.0", () => {
|
||||||
console.log(`Server is running on ${process.env.HOST}:${port}/`);
|
if (debug) {
|
||||||
log.Info(`Server is running on ${process.env.HOST}:${port}/`);
|
console.log(`Server is running on ${process.env.HOST}:${port}/`);
|
||||||
|
} else {
|
||||||
|
log.Info(`Server is running on ${process.env.HOST}:${port}/`);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue