Introduce endpoint for auth check

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-08-24 19:42:36 +01:00
parent 74a68e992a
commit c7b1c547b0
2 changed files with 11 additions and 1 deletions

View File

@ -35,8 +35,17 @@ async function getUser(req, res, next) {
}
}
async function checkAuth(req,res,next) {
if (! req.isAuthed) {
res.status(401).body("Not Authorised")
} else {
res.status(200).body("Authorised Successfully")
}
next()}
module.exports = {
register,
request,
getUser
getUser,
checkAuth
};

View File

@ -4,6 +4,7 @@ const regCtr = require('../controllers/registration.controllers');
// User
router.get('/:uuid', regCtr.getUser);
router.get('/checkAuth', regCtr.checkAuth);
// Not Implemented router.delete('/:uuid', regCtr.deleteUser);
router.post('/request', regCtr.request);
router.post('/register', regCtr.register);