tsviewer/features/api/server/handler.go

21 lines
434 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-21 17:53:33 +00:00
s, err := s.ServerInfo()
2019-01-16 21:01:48 +00:00
if err != nil {
return http.StatusNotFound, err
}
return response.New(s, r).Send(w, http.StatusOK)
}))
})
}