2017-09-23 21:52:39 +08:00
|
|
|
package mainflux
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"net/http"
|
|
|
|
)
|
|
|
|
|
2018-03-16 21:06:12 +08:00
|
|
|
const version string = "0.1.2"
|
2017-09-23 21:52:39 +08:00
|
|
|
|
|
|
|
type response struct {
|
|
|
|
Version string
|
|
|
|
}
|
|
|
|
|
|
|
|
// Version exposes an HTTP handler for retrieving service version.
|
|
|
|
func Version() http.HandlerFunc {
|
|
|
|
return http.HandlerFunc(func(rw http.ResponseWriter, _ *http.Request) {
|
|
|
|
res := response{Version: version}
|
|
|
|
|
|
|
|
data, _ := json.Marshal(res)
|
|
|
|
|
|
|
|
rw.Write(data)
|
|
|
|
})
|
|
|
|
}
|