web

package
v0.0.0-...-c1f4788 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticateMiddleware

func AuthenticateMiddleware(a Authenticator) xhttp.Middleware

func WriteError

func WriteError(w http.ResponseWriter, httpStatus int, code int, msg string) error

func WriteJson

func WriteJson(w http.ResponseWriter, v interface{}) error

func WriteNoContent

func WriteNoContent(w http.ResponseWriter)

Types

type AuthResult

type AuthResult interface {
	AppId() string
	DeviceId() string
	UserId() *string
}

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
}

func (*Route) Connect

func (r *Route) Connect(path string, h http.Handler, middlewares ...xhttp.Middleware)

func (*Route) Delete

func (r *Route) Delete(path string, h http.Handler, middlewares ...xhttp.Middleware)

func (*Route) Get

func (r *Route) Get(path string, h http.Handler, middlewares ...xhttp.Middleware)

func (*Route) Group

func (r *Route) Group(path string, middlewares ...xhttp.Middleware) *Route

func (*Route) Handle

func (r *Route) Handle(method string, path string, h http.Handler, middlewares ...xhttp.Middleware)

func (*Route) Head

func (r *Route) Head(path string, h http.Handler, middlewares ...xhttp.Middleware)

func (*Route) Options

func (r *Route) Options(path string, h http.Handler, middlewares ...xhttp.Middleware)

func (*Route) Patch

func (r *Route) Patch(path string, h http.Handler, middlewares ...xhttp.Middleware)

func (*Route) Post

func (r *Route) Post(path string, h http.Handler, middlewares ...xhttp.Middleware)

func (*Route) Put

func (r *Route) Put(path string, h http.Handler, middlewares ...xhttp.Middleware)

func (*Route) Trace

func (r *Route) Trace(path string, h http.Handler, middlewares ...xhttp.Middleware)

type Server

type Server struct {
	// contains filtered or unexported fields
}

func New

func New(middlewares ...xhttp.Middleware) *Server

func (*Server) Connect

func (s *Server) Connect(path string, h http.Handler, middlewares ...xhttp.Middleware)

func (*Server) Delete

func (s *Server) Delete(path string, h http.Handler, middlewares ...xhttp.Middleware)

func (*Server) Get

func (s *Server) Get(path string, h http.Handler, middlewares ...xhttp.Middleware)

func (*Server) Group

func (s *Server) Group(path string, middlewares ...xhttp.Middleware) *Route

func (*Server) Handle

func (s *Server) Handle(method string, path string, h http.Handler, middlewares ...xhttp.Middleware)

func (*Server) Head

func (s *Server) Head(path string, h http.Handler, middlewares ...xhttp.Middleware)

func (*Server) Options

func (s *Server) Options(path string, h http.Handler, middlewares ...xhttp.Middleware)

func (*Server) Patch

func (s *Server) Patch(path string, h http.Handler, middlewares ...xhttp.Middleware)

func (*Server) Post

func (s *Server) Post(path string, h http.Handler, middlewares ...xhttp.Middleware)

func (*Server) Put

func (s *Server) Put(path string, h http.Handler, middlewares ...xhttp.Middleware)

func (*Server) Run

func (s *Server) Run(addr string) error

func (*Server) Trace

func (s *Server) Trace(path string, h http.Handler, middlewares ...xhttp.Middleware)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL