github.com/safedep/dry@v0.0.0-20241016050132-a15651f0548b/adapters/http/router.go (about)

     1  package http
     2  
     3  import (
     4  	"net/http"
     5  )
     6  
     7  type RouteMethod string
     8  
     9  const (
    10  	GET     RouteMethod = "GET"
    11  	POST    RouteMethod = "POST"
    12  	PUT     RouteMethod = "PUT"
    13  	DELETE  RouteMethod = "DELETE"
    14  	OPTIONS RouteMethod = "OPTIONS"
    15  	ANY     RouteMethod = "ANY"
    16  
    17  	HealthPath  = "/health"
    18  	MetricsPath = "/metrics"
    19  )
    20  
    21  type Router interface {
    22  	AddRoute(method RouteMethod, path string, handler http.Handler)
    23  	Handler() http.Handler
    24  	ListenAndServe(address string) error
    25  }