-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathroutes.js
32 lines (23 loc) · 872 Bytes
/
routes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import {
RecordDisengagement,
DisplayDisengagements,
GetDisengagements,
} from "./controllers/disengagements/DisengagementController";
import { GetVersions, AddVersion } from "./controllers/versions/VersionsController"
const routes = (app) => {
app.get("/welcome", async (req, res) => {
res.send("Welcome. Send your data to the api at the /record endpoint");
});
app.route("/record").post(RecordDisengagement);
app.route("/disengagements").get(DisplayDisengagements);
app.route("/view-disengagements").get(GetDisengagements);
app.route("/admin/addVersion").post(AddVersion)
app.route("/versions").get(GetVersions)
app.get("*", async (req, res) => {
res.redirect("/disengagements");
});
app.post("*", async (req, res) => {
res.redirect("/disengagements");
});
};
module.exports = { routes };