Mercurial > gemma
view controllers/routes.go @ 226:63dd5216eee4
Refactored gemma server to be more REST-like.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Thu, 26 Jul 2018 12:24:30 +0200 |
parents | |
children | 694f959ba3e7 |
line wrap: on
line source
package controllers import ( "net/http" "gemma.intevation.de/gemma/auth" "github.com/gorilla/mux" ) func BindRoutes(m *mux.Router) { api := m.PathPrefix("/api").Subrouter() sysAdmin := auth.EnsureRole("sys_admin") api.Handle("/users", sysAdmin(createUser)).Methods(http.MethodPost) api.HandleFunc("/login", token). Methods(http.MethodGet, http.MethodPost) api.Handle("/logout", auth.SessionMiddleware(http.HandlerFunc(token))). Methods(http.MethodGet, http.MethodPost) api.Handle("/renew", auth.SessionMiddleware(http.HandlerFunc(renew))). Methods(http.MethodGet, http.MethodPost) }