32 lines
		
	
	
		
			557 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			557 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Package resolver resolves a http request to an endpoint
 | |
| package resolver
 | |
| 
 | |
| import (
 | |
| 	"net/http"
 | |
| )
 | |
| 
 | |
| // Resolver resolves requests to endpoints
 | |
| type Resolver interface {
 | |
| 	Resolve(r *http.Request) (*Endpoint, error)
 | |
| 	String() string
 | |
| }
 | |
| 
 | |
| // Endpoint is the endpoint for a http request
 | |
| type Endpoint struct {
 | |
| 	// e.g greeter
 | |
| 	Name string
 | |
| 	// HTTP Host e.g example.com
 | |
| 	Host string
 | |
| 	// HTTP Methods e.g GET, POST
 | |
| 	Method string
 | |
| 	// HTTP Path e.g /greeter.
 | |
| 	Path string
 | |
| }
 | |
| 
 | |
| type Options struct {
 | |
| 	Handler   string
 | |
| 	Namespace string
 | |
| }
 | |
| 
 | |
| type Option func(o *Options)
 |