How to make http routers available only to certain roles

I can’t get the http to be available according to the user’s role. I have 2 roles and I’ve set up a middleware to check if the user is logged in.