forked from Cliffbreak/tsviewer
20 lines
427 B
Go
20 lines
427 B
Go
package server
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"git.cliffbreak.de/haveachin/go-tsviewer/response"
|
|
)
|
|
|
|
func InfoAPIHandler(s Service) http.HandlerFunc {
|
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
|
response.Handler(w, 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)
|
|
}))
|
|
})
|
|
}
|