1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-18 22:17:44 +02:00

make router configurable in api

This commit is contained in:
Asim Aslam
2022-07-02 14:15:02 +01:00
parent 73dc3723c7
commit e313863a2a
3 changed files with 24 additions and 5 deletions

View File

@ -7,20 +7,21 @@ import (
"regexp"
"strings"
"go-micro.dev/v4/api/router"
"go-micro.dev/v4/registry"
"go-micro.dev/v4/server"
)
// The Api interface provides a way to
// The Api interface provides a way to
// create composable API gateways
type Api interface {
// Initialise options
Init(...Option) error
// Get the options
Options() Options
// Register an endpoint
// Register an endpoint
Register(*Endpoint) error
// Deregister an endpoint
// Deregister an endpoint
Deregister(*Endpoint) error
// Run the api
Run(context.Context) error
@ -31,6 +32,8 @@ type Api interface {
type Options struct {
// Address of the server
Address string
// Router for resolving routes
Router router.Router
}
type Option func(*Options) error