Last active
January 28, 2019 13:01
-
-
Save paulobunga/bc43f27f40d16566d2814505327eafa2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const router = express.Router(); | |
const authMiddleware = require('../middleware/auth-middleware'); | |
const userController = require('../controllers/user-controller'); | |
//Get a list of all the users | |
//We are using the authentication middleware to protect this route from unauthorised access | |
router.get('/', authMiddleware.isAuthenticated, userController.getUsers); | |
router.get('/:userId', authMiddleware.isAuthenticated, userController.getSingleUser); | |
router.post('/', authMiddleware.isAuthenticated, userController.createUser); | |
router.put('/:userId', authMiddleware.isAuthenticated, userController.updateUser); | |
router.delete('/:userId', authMiddleware.isAuthenticated, userController.deleteUser); | |
module.exports = router; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment