Last active
November 8, 2019 02:52
-
-
Save bchiang7/5feaf2290fde372dd69cb7a475db356c to your computer and use it in GitHub Desktop.
This file contains 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
// routes/index.js | |
const express = require('express'); | |
const router = express.Router(); | |
// App routes (for the mobile app) | |
const APP = express.Router(); | |
router.use('/', APP); | |
APP.get('/users/:id', isAuthenticated, userController.getUser); | |
... | |
// Admin routes (for the admin tool) | |
const ADMIN = express.Router(); | |
router.use('/admin', ADMIN); | |
ADMIN.get('/users', isAuthenticated, isAdmin, adminUserController.getUsers); | |
ADMIN.get('/users/:id', isAuthenticated, isAdmin, adminUserController.getUser); | |
ADMIN.patch('/users/:id', isAuthenticated, isAdmin, adminUserController.updateUser); | |
ADMIN.delete('/users/:id', isAuthenticated, isAdmin, adminUserController.deleteUser); | |
module.exports = router; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment