Add default resolver to api router

This commit is contained in:
Ben Toogood 2020-04-09 10:34:21 +01:00
parent 3ede494945
commit 27eb7db1c2

View File

@ -2,6 +2,7 @@ package router
import ( import (
"github.com/micro/go-micro/v2/api/resolver" "github.com/micro/go-micro/v2/api/resolver"
"github.com/micro/go-micro/v2/api/resolver/vpath"
"github.com/micro/go-micro/v2/registry" "github.com/micro/go-micro/v2/registry"
) )
@ -23,6 +24,12 @@ func NewOptions(opts ...Option) Options {
o(&options) o(&options)
} }
if options.Resolver == nil {
options.Resolver = vpath.NewResolver(
resolver.WithHandler(options.Handler),
)
}
return options return options
} }