You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
677 B
32 lines
677 B
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: "/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"))
|
|
},
|
|
})
|
|
}
|
|
|