20 lines
434 B
Go
Executable file
20 lines
434 B
Go
Executable file
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.ServerInfo()
|
|
if err != nil {
|
|
return http.StatusNotFound, err
|
|
}
|
|
|
|
return response.New(s, r).Send(w, http.StatusOK)
|
|
}))
|
|
})
|
|
}
|