all setup with jwt and bcrypt with whole file structure with auth middleware and login

This commit is contained in:
Arjun Patel
2019-01-10 10:37:07 -08:00
parent 518840a576
commit 9f247154f9
10 changed files with 360 additions and 115 deletions
+10
View File
@@ -0,0 +1,10 @@
const express = require('express'),
router = express.Router(),
checkAuth = require('../middleware/check-auth');
const auth = require('../controllers/auth.controller.js');
// Check database for donor
router.post('/donor/login', auth.login);
module.exports = router;
+5 -4
View File
@@ -1,13 +1,14 @@
const express = require('express'),
router = express.Router();
router = express.Router(),
checkAuth = require('../middleware/check-auth');
const donors = require('../controllers/donors.controller.js');
// Create a new Donor
router.post('/', donors.create);
// Retrieve all Donor
router.get('/', donors.findAll);
// Retrieve all Donors
router.get('/', checkAuth, donors.findAll);
// Retrieve a single Donor by Id
router.get('/:DonorId', donors.findById);
@@ -18,4 +19,4 @@ router.delete('/:DonorId', donors.delete);
// // Update a Donor with Id
// router.put('/api/donors/:DonorId', donors.update);
module.exports = router;
module.exports = router;