mirror of
https://github.com/mainflux/mainflux.git
synced 2025-04-27 13:48:49 +08:00

* Add format to raw message and content type mapping Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add format as part of content type header Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add format to content-type header for WS adapter Add format as part of content-type and add support for content-type header and query parameter. Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add support for format and content-type in MQTT adapter Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add format and content-type to CoAP adapter Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add documentation for content type and format Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add comments to MQTT code Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Fix SenML JSON CoAP code type Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Remove format from the adapters Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Remove format from the docs Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Remove format field from MQTT adapter Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Update content type to be optional Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Add support for CBOR content type in the normalizer Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com> * Update docs for MQTT content type Signed-off-by: Aleksandar Novakovic <anovakovic01@gmail.com>
36 lines
691 B
Go
36 lines
691 B
Go
//
|
|
// Copyright (c) 2018
|
|
// Mainflux
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
package mainflux
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
)
|
|
|
|
const version string = "0.9.0"
|
|
|
|
// VersionInfo contains version endpoint response.
|
|
type VersionInfo struct {
|
|
// Service contains service name.
|
|
Service string `json:"service"`
|
|
|
|
// Version contains service current version value.
|
|
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 := VersionInfo{service, version}
|
|
|
|
data, _ := json.Marshal(res)
|
|
|
|
rw.Write(data)
|
|
})
|
|
}
|