all setup with jwt and bcrypt with whole file structure with auth middleware and login
This commit is contained in:
@@ -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;
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user