2018-08-26 19:15:48 +08:00
|
|
|
//
|
|
|
|
// Copyright (c) 2018
|
|
|
|
// Mainflux
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
//
|
|
|
|
|
2018-06-08 20:25:55 +08:00
|
|
|
// +build !test
|
|
|
|
|
2019-05-08 01:09:28 +08:00
|
|
|
package api
|
2018-06-08 20:25:55 +08:00
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/go-zoo/bone"
|
|
|
|
"github.com/mainflux/mainflux"
|
|
|
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
|
|
)
|
|
|
|
|
|
|
|
// MakeHandler returns a HTTP API handler with version and metrics.
|
2019-05-08 01:09:28 +08:00
|
|
|
func MakeHandler(svcName string) http.Handler {
|
2018-06-08 20:25:55 +08:00
|
|
|
r := bone.New()
|
2019-05-08 01:09:28 +08:00
|
|
|
r.GetFunc("/version", mainflux.Version(svcName))
|
2018-06-08 20:25:55 +08:00
|
|
|
r.Handle("/metrics", promhttp.Handler())
|
|
|
|
|
|
|
|
return r
|
|
|
|
}
|