dynamically generating the menu and middleware to expose helper functions