Skip to content

Instantly share code, notes, and snippets.

@hashbender
Created April 20, 2017 22:25
Show Gist options
  • Save hashbender/a9b75912773495f612ac09d9addf2080 to your computer and use it in GitHub Desktop.
Save hashbender/a9b75912773495f612ac09d9addf2080 to your computer and use it in GitHub Desktop.
newrouter
//NewRouter returns a new Gorrila Mux router
func NewRouter(c AppContext) *mux.Router {
router := mux.NewRouter().StrictSlash(true)
appContext = c
for _, route := range routes {
//Check all routes to make sure the users are properly authenticated
router.
Methods(route.Method...).
Path(route.Pattern).
Name(route.Name).
Handler(route.ContextedHandler)
}
return router
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment