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");
|
||||
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}/`);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue