gohttp/admin/admin.go

30 lines
689 B
Go

package admin
import (
"net/http"
"git.pyer.club/kingecg/gohttpd/model"
"git.pyer.club/kingecg/gohttpd/server"
)
func about(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Write([]byte("About Page"))
}
func setConfig(w http.ResponseWriter, r *http.Request) {
}
var AdminServerMux *server.RestMux
func init() {
AdminServerMux = server.NewRestMux("/")
AdminServerMux.Use(server.BasicAuth)
AdminServerMux.HandleFunc("GET", "/about", http.HandlerFunc(about))
postConfigRoute := AdminServerMux.HandleFunc("POST", "/config", http.HandlerFunc(setConfig))
postConfigRoute.Add(server.Parse[model.HttpServerConfig])
AdminServerMux.Use(server.BasicAuth)
}