Documentation ¶
Index ¶
- Variables
- func CallbackBearerAuth(req *Request, data interface{})
- func NewHTTPServer(svc Service, addr string, multicore bool) *httpServer
- type Filter
- type GrpcServer
- type HttpStatusMsg
- type Request
- type Response
- type Router
- func (r *Router) CONNECT(pattern string, svc Service)
- func (r *Router) DELETE(pattern string, svc Service)
- func (r *Router) GET(pattern string, svc Service)
- func (r *Router) HEAD(pattern string, svc Service)
- func (r Router) Lookup(method, path string) (Service, string, map[string]string, bool)
- func (r *Router) OPTIONS(pattern string, svc Service)
- func (r *Router) PATCH(pattern string, svc Service)
- func (r *Router) POST(pattern string, svc Service)
- func (r *Router) PUT(pattern string, svc Service)
- func (r Router) Params(req Request) map[string]string
- func (r Router) Pattern(req Request) string
- func (r *Router) Register(method, pattern string, svc Service)
- func (r Router) Serve() Service
- func (r *Router) TRACE(pattern string, svc Service)
- type Service
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MatchCodeToMessage = map[int]HttpStatusMsg{ 500: InternalServerError, 400: BadRequest, 403: Unauthorized, 200: OK, } )
Functions ¶
func CallbackBearerAuth ¶
func CallbackBearerAuth(req *Request, data interface{})
func NewHTTPServer ¶
Types ¶
type GrpcServer ¶
type GrpcServer struct {
// contains filtered or unexported fields
}
func NewGrpcServer ¶
func NewGrpcServer() *GrpcServer
func (*GrpcServer) RegisterHandler ¶
func (s *GrpcServer) RegisterHandler(path string, handler http.Handler)
func (*GrpcServer) Serve ¶
func (s *GrpcServer) Serve(port int32)
type HttpStatusMsg ¶
type HttpStatusMsg string
const ( InternalServerError HttpStatusMsg = "internal server error" BadRequest HttpStatusMsg = "bad request" OK HttpStatusMsg = "OK" )
func (HttpStatusMsg) B ¶
func (h HttpStatusMsg) B() []byte
type Request ¶
type Response ¶
func NewResponse ¶
NewResponse constructs a Response with status code 200.
func NewResponseWithCode ¶
NewResponseWithCode constructs a Response with the given status code.
func TraceFilter ¶
func (*Response) EncodeAsJSON ¶
func (r *Response) EncodeAsJSON(v interface{})
EncodeAsJSON writes the response as JSON. This is the default encoding type when using Encode.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func RouterForRequest ¶
func (Router) Lookup ¶
Lookup returns the Service, pattern, and extracted path parameters for the HTTP method and path.
func (Router) Params ¶
Params returns extracted path parameters, assuming the request has been routed and has captured parameters.
Click to show internal directories.
Click to hide internal directories.