mirror of
https://github.com/hanzo-fi/stack.git
synced 2026-10-30 20:34:43 +00:00
36 lines
799 B
Go
36 lines
799 B
Go
package routes
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/formancehq/stack/ee/stargate/internal/client/controllers"
|
|
"github.com/formancehq/stack/libs/go-libs/health"
|
|
"github.com/formancehq/stack/libs/go-libs/logging"
|
|
"github.com/go-chi/chi/v5"
|
|
"github.com/go-chi/chi/v5/middleware"
|
|
"github.com/go-chi/cors"
|
|
)
|
|
|
|
func NewRouter(
|
|
logger logging.Logger,
|
|
healthController *health.HealthController,
|
|
stargateController *controllers.StargateController,
|
|
) chi.Router {
|
|
router := chi.NewMux()
|
|
|
|
router.Use(
|
|
cors.New(cors.Options{
|
|
AllowOriginFunc: func(r *http.Request, origin string) bool {
|
|
return true
|
|
},
|
|
AllowCredentials: true,
|
|
}).Handler,
|
|
middleware.Recoverer,
|
|
)
|
|
|
|
router.Get("/_healthcheck", healthController.Check)
|
|
router.Get("/_info", stargateController.GetInfo)
|
|
|
|
return router
|
|
}
|