go-tsviewer/features/server/handler.go
2019-01-17 01:35:51 +01:00

20 lines
428 B
Go

package server
import (
"net/http"
"git.cliffbreak.de/Cliffbreak/tsviewer/response"
)
func InfoAPIHandler(s Service) http.HandlerFunc {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
response.Handler(w, r, response.HandlerFunc(func() (int, error) {
s, err := s.Info()
if err != nil {
return http.StatusNotFound, err
}
return response.New(s, r).Send(w, http.StatusOK)
}))
})
}