-
-
Save amandeepmittal/7d3ac7c7bb73ce5a2fae8e2a7aa0f16f 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
import express from 'express'; | |
import { | |
registerUser, | |
findUserById, | |
findUserProfile, | |
deleteUser | |
} from '../controllers/user'; | |
// import them to protect routes | |
import { requireSignin, hasAuthorization } from '../controllers/auth'; | |
const router = express.Router(); | |
router.route('/api/users').post(registerUser); | |
router | |
.route('/api/users/:userId') | |
.get(requireSignin, findUserProfile) | |
.delete(requireSignin, hasAuthorization, deleteUser); | |
router.param('userId', findUserById); | |
export default router; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment