diff --git a/src/controllers/registration.controllers.js b/src/controllers/registration.controllers.js index 37b4d20..4cc4ba0 100644 --- a/src/controllers/registration.controllers.js +++ b/src/controllers/registration.controllers.js @@ -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 }; \ No newline at end of file diff --git a/src/routes/user2.routes.js b/src/routes/user2.routes.js index 0b29e00..03a5588 100644 --- a/src/routes/user2.routes.js +++ b/src/routes/user2.routes.js @@ -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);