🛂 Add key-based permission system

This commit is contained in:
2023-06-20 19:53:34 +02:00
parent 917783d114
commit 5d9317ac01
11 changed files with 432 additions and 17 deletions

View File

@ -8,6 +8,9 @@ import {
getSubstitutions,
getHistory,
getClasses,
getInfo,
putKey,
deleteKey,
} from "./api/index.js";
import auth from "./api/auth.js";
import { Parser } from "./parser/index.js";
@ -30,6 +33,7 @@ const port = process.env.PORT || 3000;
app.use(cors());
app.use(cookieParser());
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
// Initialize the Parser and set it to update the
// substitution plan at the specified update interval
@ -55,6 +59,9 @@ app.get("/api/check", (_req, res) => {
});
// Register API endpoints
app.get("/api/info", getInfo);
app.put("/api/key", putKey);
app.delete("/api/key", deleteKey);
app.get("/api/timetable", getTimetable);
app.get("/api/substitutions", getSubstitutions);
app.get("/api/history", getHistory);