diff --git a/api/api.go b/api/api.go index eb6af0e..b8659d3 100644 --- a/api/api.go +++ b/api/api.go @@ -44,10 +44,16 @@ func BuildApis(config *viper.Viper) fx.Option { return nil })) - options = append(options, fx.Invoke(func(protocols []registry.API) { + options = append(options, fx.Invoke(func(protocols []registry.API) error { for _, protocol := range protocols { - middleware.RegisterProtocolSubdomain(config, protocol.Routes(), protocol.Name()) + routes, err := protocol.Routes() + if err != nil { + return err + } + middleware.RegisterProtocolSubdomain(config, routes, protocol.Name()) } + + return nil })) return fx.Module("api", fx.Options(options...)) diff --git a/api/registry/registry.go b/api/registry/registry.go index 951b7e0..4820057 100644 --- a/api/registry/registry.go +++ b/api/registry/registry.go @@ -14,7 +14,7 @@ type API interface { Init() error Start(ctx context.Context) error Stop(ctx context.Context) error - Routes() *httprouter.Router + Routes() (*httprouter.Router, error) } type APIEntry struct {