package controllers import ( "net/http" "git.kirsle.net/apps/gophertype/pkg/glue" "git.kirsle.net/apps/gophertype/pkg/middleware" "github.com/gorilla/mux" ) func init() { glue.Register(glue.Endpoint{ Path: "/about", Middleware: []mux.MiddlewareFunc{ middleware.ExampleMiddleware, }, Handler: func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("About Site")) }, }) glue.Register(glue.Endpoint{ Path: "/admin", Middleware: []mux.MiddlewareFunc{ middleware.ExampleMiddleware, }, Handler: func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Admin index")) }, }) glue.Register(glue.Endpoint{ Path: "/admin/users", Methods: []string{"GET", "POST"}, Middleware: []mux.MiddlewareFunc{ middleware.ExampleMiddleware, }, Handler: func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Admin users page")) }, }) }