mirror of
https://github.com/hanzo-fi/stack.git
synced 2026-10-30 20:34:43 +00:00
22 lines
530 B
Go
22 lines
530 B
Go
package api
|
|
|
|
import (
|
|
sharedapi "github.com/formancehq/go-libs/api"
|
|
sharedhealth "github.com/formancehq/go-libs/health"
|
|
"github.com/formancehq/go-libs/httpserver"
|
|
"github.com/go-chi/chi/v5"
|
|
"go.uber.org/fx"
|
|
)
|
|
|
|
func Module(serviceInfo sharedapi.ServiceInfo, listen string) fx.Option {
|
|
return fx.Module(
|
|
"api",
|
|
fx.Provide(NewRouter),
|
|
fx.Supply(serviceInfo),
|
|
sharedhealth.Module(),
|
|
fx.Invoke(func(lc fx.Lifecycle, router *chi.Mux) {
|
|
lc.Append(httpserver.NewHook(router, httpserver.WithAddress(listen)))
|
|
}),
|
|
)
|
|
}
|