refactor: clean up code formatting and improve readability in timetable endpoint
This commit is contained in:
18
index.js
18
index.js
@@ -18,7 +18,7 @@ app.get('/timetable', async (req, res) => {
|
|||||||
|
|
||||||
const now = luxon.DateTime.local();
|
const now = luxon.DateTime.local();
|
||||||
const startOfWeek = now.startOf('week').toJSDate(); // Montag
|
const startOfWeek = now.startOf('week').toJSDate(); // Montag
|
||||||
const endOfWeek = now.endOf('week').plus({ days: 7*4*4 }).toJSDate(); // Sonntag
|
const endOfWeek = now.endOf('week').plus({ days: 7 * 4 * 4 }).toJSDate(); // Sonntag
|
||||||
|
|
||||||
// Stundenplan für diese Woche abrufen
|
// Stundenplan für diese Woche abrufen
|
||||||
const timetable = await untis.getOwnTimetableForRange(startOfWeek, endOfWeek);
|
const timetable = await untis.getOwnTimetableForRange(startOfWeek, endOfWeek);
|
||||||
@@ -32,7 +32,21 @@ app.get('/timetable', async (req, res) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(process.env)
|
const os = require('os');
|
||||||
|
const nets = os.networkInterfaces();
|
||||||
|
const results = {};
|
||||||
|
|
||||||
|
for (const name of Object.keys(nets)) {
|
||||||
|
for (const net of nets[name]) {
|
||||||
|
if (!net.internal) {
|
||||||
|
results[name] = results[name] || [];
|
||||||
|
results[name].push(net.address);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('Local IPs:', results);
|
||||||
|
|
||||||
|
|
||||||
app.listen(port, () => {
|
app.listen(port, () => {
|
||||||
console.log(`Example app listening on port ${port}`)
|
console.log(`Example app listening on port ${port}`)
|
||||||
|
|||||||
Reference in New Issue
Block a user