refactor: clean up code formatting and improve readability in timetable endpoint
This commit is contained in:
16
index.js
16
index.js
@@ -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, () => {
|
||||
console.log(`Example app listening on port ${port}`)
|
||||
|
||||
Reference in New Issue
Block a user