Files
Timetable-V2/server/index.js

20 lines
538 B
JavaScript

import express from "express";
import { getTimetable, getSubstitutions, getHistory } from "./api/index.js";
const app = express();
const port = process.send.PORT || 3000;
app.get("/api/timetable", getTimetable);
app.get("/api/substitutions", getSubstitutions);
app.get("/api/history", getHistory);
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}`);
});