github.com/btccom/go-micro/v2@v2.9.3/api/router/router.go (about)

     1  // Package router provides api service routing
     2  package router
     3  
     4  import (
     5  	"net/http"
     6  
     7  	"github.com/btccom/go-micro/v2/api"
     8  )
     9  
    10  // Router is used to determine an endpoint for a request
    11  type Router interface {
    12  	// Returns options
    13  	Options() Options
    14  	// Stop the router
    15  	Close() error
    16  	// Endpoint returns an api.Service endpoint or an error if it does not exist
    17  	Endpoint(r *http.Request) (*api.Service, error)
    18  	// Register endpoint in router
    19  	Register(ep *api.Endpoint) error
    20  	// Deregister endpoint from router
    21  	Deregister(ep *api.Endpoint) error
    22  	// Route returns an api.Service route
    23  	Route(r *http.Request) (*api.Service, error)
    24  }