Documentation ¶
Index ¶
- type Config
- type Ctx
- type Handler
- type HandlerFunc
- type MiddlewareHandler
- type Option
- type Router
- type Server
- func (r Server) Any(path string, f Handler)
- func (r Server) Connect(path string, f Handler)
- func (r Server) Delete(path string, f Handler)
- func (r Server) Get(path string, f Handler)
- func (s *Server) Handler(hf HandlerFunc)
- func (r Server) Head(path string, f Handler)
- func (r Server) HostPrefix(host string) *router
- func (r Server) Options(path string, f Handler)
- func (r Server) Patch(path string, f Handler)
- func (r Server) PathPrefix(prefix string) *router
- func (r Server) Post(path string, f Handler)
- func (r Server) Put(path string, f Handler)
- func (s *Server) Run() error
- func (r Server) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (s *Server) Shutdown() error
- func (r Server) Trace(path string, f Handler)
- func (r Server) Use(fs ...MiddlewareHandler)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ctx ¶ added in v0.2.0
type Ctx interface { context.Context Request() *http.Request Abort() IsAbort() bool Set(key string, value any) Get(key string) (value any, exists bool) GetString(key string) (s string) GetBool(key string) (b bool) GetInt(key string) (i int) GetInt64(key string) (i64 int64) GetFloat64(key string) (f64 float64) Param(key string) string ParamBool(key string) bool ParamInt(key string) int ParamInt64(key string) int64 ParamFloat64(key string) float64 QueryArray(key string) (values []string, ok bool) Query(key string) (string, bool) QueryString(key string) string QueryBool(key string) bool QueryInt(key string) int QueryInt64(key string) int64 QueryFloat64(key string) float64 PostFormArray(key string) (values []string, ok bool) PostForm(key string) (string, bool) PostFormString(key string) string PostFormBool(key string) bool PostFormInt(key string) int PostFormInt64(key string) int64 PostFormFloat64(key string) float64 FormFileHeader(name string) (*multipart.FileHeader, error) JsonBinding(d any) error GetHeader(key string) string Header(key, value string) Cookie(name string) (string, error) SetCookie(name, value string, maxAge int, path, domain string, secure, httpOnly bool, sameSite http.SameSite) Status(code int) ResponseWithStatus(code int, data []byte) error Response(data []byte) error Json(data any) error String(data string) error }
type HandlerFunc ¶ added in v0.2.0
type MiddlewareHandler ¶ added in v0.2.0
type MiddlewareHandler func(ctx Ctx, next func())
type Option ¶
type Option struct { Config MaxHeaderBytes int MaxMultipartMemory int64 ConnState func(net.Conn, http.ConnState) TLSConfig *tls.Config TLSNextProto map[string]func(*http.Server, *tls.Conn, http.Handler) ErrorLog *log.Logger BaseContext func(net.Listener) context.Context ConnContext func(ctx context.Context, c net.Conn) context.Context }
type Router ¶ added in v0.2.0
type Router interface { Get(path string, f Handler) Head(path string, f Handler) Post(path string, f Handler) Put(path string, f Handler) Patch(path string, f Handler) Delete(path string, f Handler) Connect(path string, f Handler) Options(path string, f Handler) Trace(path string, f Handler) Any(path string, f Handler) Use(fs ...MiddlewareHandler) PathPrefix(prefix string) *router HostPrefix(host string) *router }
type Server ¶
type Server struct { Option // contains filtered or unexported fields }
func (*Server) Handler ¶ added in v0.2.0
func (s *Server) Handler(hf HandlerFunc)
func (Server) HostPrefix ¶
func (r Server) HostPrefix(host string) *router
func (Server) PathPrefix ¶
func (r Server) PathPrefix(prefix string) *router
func (Server) ServeHTTP ¶ added in v0.2.0
func (r Server) ServeHTTP(w http.ResponseWriter, req *http.Request)
func (Server) Use ¶
func (r Server) Use(fs ...MiddlewareHandler)
Click to show internal directories.
Click to hide internal directories.