24 lines
399 B
Go
24 lines
399 B
Go
package mainflux
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
)
|
|
|
|
const version string = "0.1.2"
|
|
|
|
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)
|
|
})
|
|
}
|