From 2908249c51da7dc77993a15b6c85994d8a222cf1 Mon Sep 17 00:00:00 2001
From: Yorick <yorickdevries@live.com>
Date: Sun, 13 Sep 2020 16:52:20 +0200
Subject: [PATCH] remove keep-alive script and change api
---
peer_alive.sh | 12 ------------
server/src/routes/api.ts | 4 +---
2 files changed, 1 insertion(+), 15 deletions(-)
delete mode 100644 peer_alive.sh
diff --git a/peer_alive.sh b/peer_alive.sh
deleted file mode 100644
index f27ca7c96..000000000
--- a/peer_alive.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-DATE=$(date +"%Y%m%d%H%M%S")
-RESPONSECODE=$(curl --head --max-time 120 -s -o /dev/null -w "%{http_code}" https://peer.tudelft.nl/api/faculties)
-curl --max-time 120 https://peer.tudelft.nl/api/faculties
-
-if [[ $? -eq 0 && $RESPONSECODE -eq 200 ]]
-then
- echo "${DATE} alive $? $RESPONSECODE" >> /data_nfs/peer/peer_alive.log
-else
- echo "${DATE} dead $? $RESPONSECODE" >> /data_nfs/peer/peer_alive.log
- /usr/sbin/service peer restart
-fi
diff --git a/server/src/routes/api.ts b/server/src/routes/api.ts
index 64dbcccf7..c1731b5aa 100644
--- a/server/src/routes/api.ts
+++ b/server/src/routes/api.ts
@@ -43,9 +43,6 @@ router.get("/authenticated", (req, res) => {
res.send({ authenticated: req.isAuthenticated() });
});
-// move faculties outside of checkAndSetAuthentication for debugging
-router.use("/faculties", faculties);
-
// Check always whether someone is logged in before accessing the other routes below
// additionally fixes the user object so all fields are copied over from the database
router.use(checkAndSetAuthentication);
@@ -59,6 +56,7 @@ router.get("/me", async (req, res) => {
// TODO: Complete routing of the new API
router.use("/users", users);
+router.use("/faculties", faculties);
router.use("/academicyears", academicyears);
router.use("/courses", courses);
router.use("/enrollments", enrollments);
--
GitLab