Files
Timetable-V2/server/index.js
2022-05-01 23:58:49 +02:00

26 lines
595 B
JavaScript

import express from "express";
import {
getTimetable,
getSubstitutions,
getHistory,
getClasses,
} from "./api/index.js";
const app = express();
const port = process.env.PORT || 3000;
app.get("/api/timetable", getTimetable);
app.get("/api/substitutions", getSubstitutions);
app.get("/api/history", getHistory);
app.get("/api/classes", getClasses);
app.get("/api/*", (req, res) => {
res.sendStatus(400);
});
app.use("/", express.static("../dist"));
app.use("/*", express.static("../dist"));
app.listen(port, () => {
console.log(`Server listening on http://localhost:${port}`);
});