fixed folder structure
This commit is contained in:
@@ -8,11 +8,9 @@ const moment = require('moment');
|
|||||||
const command = process.platform === 'win32' ? 'python' : 'python3';
|
const command = process.platform === 'win32' ? 'python' : 'python3';
|
||||||
// Pfad zum Kalender-Skript
|
// Pfad zum Kalender-Skript
|
||||||
const scriptPath = path.resolve(__dirname, 'getCalendar.py');
|
const scriptPath = path.resolve(__dirname, 'getCalendar.py');
|
||||||
|
// Pfad zum Ordner mit den Webseiten-Dateien
|
||||||
|
const static = path.join(__dirname, 'static');
|
||||||
|
|
||||||
const templates = path.join(__dirname, 'templates');
|
|
||||||
|
|
||||||
// Stelle den Pfad zum "views" Verzeichnis ein
|
|
||||||
app.set('views', templates);
|
|
||||||
// Verwende EJS als Vorlagen-Engine
|
// Verwende EJS als Vorlagen-Engine
|
||||||
app.set('view engine', 'ejs');
|
app.set('view engine', 'ejs');
|
||||||
|
|
||||||
@@ -60,14 +58,20 @@ function getCalendarEntries(week) {
|
|||||||
];
|
];
|
||||||
|
|
||||||
// Skript ausführen und Output in einer Variable speichern
|
// Skript ausführen und Output in einer Variable speichern
|
||||||
const result = spawnSync(command, [scriptPath, ...args], { encoding: 'utf-8' });
|
const result = spawnSync(command, [scriptPath, ...args], { encoding: 'utf-8' }).stdout;
|
||||||
|
|
||||||
return result.stdout;
|
if (result === "") {
|
||||||
|
return "Keine Termine gefunden";
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.use("/", express.static(static));
|
||||||
|
|
||||||
// Definiere eine Route für die Startseite
|
// Definiere eine Route für die Startseite
|
||||||
app.get('/', (req, res) => {
|
app.get('/', (req, res) => {
|
||||||
res.render('index', { options:getLast50Weeks() });
|
res.render(path.join(static, 'index'), { options:getLast50Weeks() });
|
||||||
});
|
});
|
||||||
|
|
||||||
// Definiere eine Route für die Ausgabe der Daten
|
// Definiere eine Route für die Ausgabe der Daten
|
||||||
|
|||||||
Reference in New Issue
Block a user