Update substitutions automatically

This commit is contained in:
2022-05-03 18:56:00 +02:00
parent 1c8a307815
commit 87e7df5f90
2 changed files with 15 additions and 14 deletions

View File

@ -5,10 +5,21 @@ import {
getHistory,
getClasses,
} from "./api/index.js";
import { Parser } from "./parser/index.js";
const app = express();
const port = process.env.PORT || 3000;
if (!process.env.DSB_USER || !process.env.DSB_PASSWORD) {
console.error("Error: DSB Auth environment variables missing!");
process.exit(1);
}
const parser = new Parser(
process.env.DSB_USER,
process.env.DSB_PASSWORD,
process.env.UPDATE_INTERVAL || 1 * 60 * 1000
);
app.get("/api/timetable", getTimetable);
app.get("/api/substitutions", getSubstitutions);
app.get("/api/history", getHistory);