added roles with checking in middleware

- still need signup for orgs
- login for admin
This commit is contained in:
Arjun Patel
2019-01-26 20:23:06 -08:00
parent 794980ff61
commit 2bf26fccbf
13 changed files with 111 additions and 29 deletions
+7 -3
View File
@@ -1,10 +1,14 @@
const express = require('express'),
router = express.Router(),
checkAuth = require('../middleware/check-auth');
checkAuth = require('../middleware/check-auth'),
roles = require('../helpers/roles');
const auth = require('../controllers/auth.controller.js');
// Check database for donor
router.post('/donor/login', auth.login);
// Check database for donor and get token with donor role
router.post('/donor/login', auth.login('donor', roles.DONOR));
// Check database for org and get token with org role
router.post('/org/login', auth.login('org', roles.ORGANIZATION));
module.exports = router;