Documentation ¶
Index ¶
- func AuthenticateMiddleware(a Authenticator) xhttp.Middleware
- func WriteError(w http.ResponseWriter, httpStatus int, code int, msg string) error
- func WriteJson(w http.ResponseWriter, v interface{}) error
- func WriteNoContent(w http.ResponseWriter)
- type AuthResult
- type Authenticator
- type Route
- func (r *Route) Connect(path string, h http.Handler, middlewares ...xhttp.Middleware)
- func (r *Route) Delete(path string, h http.Handler, middlewares ...xhttp.Middleware)
- func (r *Route) Get(path string, h http.Handler, middlewares ...xhttp.Middleware)
- func (r *Route) Group(path string, middlewares ...xhttp.Middleware) *Route
- func (r *Route) Handle(method string, path string, h http.Handler, middlewares ...xhttp.Middleware)
- func (r *Route) Head(path string, h http.Handler, middlewares ...xhttp.Middleware)
- func (r *Route) Options(path string, h http.Handler, middlewares ...xhttp.Middleware)
- func (r *Route) Patch(path string, h http.Handler, middlewares ...xhttp.Middleware)
- func (r *Route) Post(path string, h http.Handler, middlewares ...xhttp.Middleware)
- func (r *Route) Put(path string, h http.Handler, middlewares ...xhttp.Middleware)
- func (r *Route) Trace(path string, h http.Handler, middlewares ...xhttp.Middleware)
- type Server
- func (s *Server) Connect(path string, h http.Handler, middlewares ...xhttp.Middleware)
- func (s *Server) Delete(path string, h http.Handler, middlewares ...xhttp.Middleware)
- func (s *Server) Get(path string, h http.Handler, middlewares ...xhttp.Middleware)
- func (s *Server) Group(path string, middlewares ...xhttp.Middleware) *Route
- func (s *Server) Handle(method string, path string, h http.Handler, middlewares ...xhttp.Middleware)
- func (s *Server) Head(path string, h http.Handler, middlewares ...xhttp.Middleware)
- func (s *Server) Options(path string, h http.Handler, middlewares ...xhttp.Middleware)
- func (s *Server) Patch(path string, h http.Handler, middlewares ...xhttp.Middleware)
- func (s *Server) Post(path string, h http.Handler, middlewares ...xhttp.Middleware)
- func (s *Server) Put(path string, h http.Handler, middlewares ...xhttp.Middleware)
- func (s *Server) Run(addr string) error
- func (s *Server) Trace(path string, h http.Handler, middlewares ...xhttp.Middleware)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthenticateMiddleware ¶
func AuthenticateMiddleware(a Authenticator) xhttp.Middleware
func WriteError ¶
func WriteJson ¶
func WriteJson(w http.ResponseWriter, v interface{}) error
func WriteNoContent ¶
func WriteNoContent(w http.ResponseWriter)
Types ¶
type AuthResult ¶
type Authenticator ¶
type Authenticator interface {
Authenticate(r *http.Request) (authResult AuthResult, need bool, err error)
}
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func New ¶
func New(middlewares ...xhttp.Middleware) *Server
Click to show internal directories.
Click to hide internal directories.