mirror of
https://github.com/absmach/supermq.git
synced 2026-06-23 04:20:17 +00:00
7066101996
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
29 lines
796 B
Go
29 lines
796 B
Go
// Copyright (c) Magistrala
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
package http
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
mainflux "github.com/absmach/magistrala"
|
|
"github.com/absmach/magistrala/auth"
|
|
"github.com/absmach/magistrala/auth/api/http/keys"
|
|
"github.com/absmach/magistrala/auth/api/http/policies"
|
|
"github.com/absmach/magistrala/logger"
|
|
"github.com/go-zoo/bone"
|
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
|
)
|
|
|
|
// MakeHandler returns a HTTP handler for API endpoints.
|
|
func MakeHandler(svc auth.Service, logger logger.Logger, instanceID string) http.Handler {
|
|
mux := bone.New()
|
|
|
|
mux = keys.MakeHandler(svc, mux, logger)
|
|
mux = policies.MakeHandler(svc, mux, logger)
|
|
|
|
mux.GetFunc("/health", mainflux.Health("auth", instanceID))
|
|
mux.Handle("/metrics", promhttp.Handler())
|
|
|
|
return mux
|
|
}
|