1
0
mirror of https://github.com/mainflux/mainflux.git synced 2025-04-27 13:48:49 +08:00
Mainflux.mainflux/version.go
2018-05-15 17:13:09 +02:00

25 lines
463 B
Go

package mainflux
import (
"encoding/json"
"net/http"
)
const version string = "0.3.1"
type response struct {
Service string `json:"service"`
Version string `json:"version"`
}
// Version exposes an HTTP handler for retrieving service version.
func Version(service string) http.HandlerFunc {
return http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) {
res := response{service, version}
data, _ := json.Marshal(res)
rw.Write(data)
})
}