go-tsviewer/features/server/handler.go

21 lines
428 B
Go
Raw Normal View History

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