Skip to content

Instantly share code, notes, and snippets.

@vonvick
Last active March 27, 2019 14:01
Show Gist options
  • Save vonvick/60448d474db7c29f81417ee9bf181b31 to your computer and use it in GitHub Desktop.
Save vonvick/60448d474db7c29f81417ee9bf181b31 to your computer and use it in GitHub Desktop.
Usage of middleware in route
import {
hasAdminRole,
decodeFirebaseIdToken,
isAuthorized
} from '../controllers/middleware/auth.middleware';
const UserRoute = (router) => {
// Get all users
router.route('/users')
.get(
decodeFirebaseIdToken,
isAuthorized,
hasAdminRole,
UserController.getAllUsers
)
}
export default UserRoute;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment