Documentation
¶
Overview ¶
framework/fasthttp/adapter.go
framework/fasthttp/context.go
framework/fasthttp/server.go
Index ¶
- func Adapter(handler simplehttp.HandlerFunc) fasthttp.RequestHandler
- func MiddlewareAdapter(middleware simplehttp.MiddlewareFunc) func(fasthttp.RequestHandler) fasthttp.RequestHandler
- func URIString2URL(uristring string) *url.URL
- type FHContext
- func (c *FHContext) Bind(v interface{}) error
- func (c *FHContext) BindForm(v interface{}) error
- func (c *FHContext) BindJSON(v interface{}) error
- func (c *FHContext) Context() context.Context
- func (c *FHContext) Get(key string) interface{}
- func (c *FHContext) GetBody() []byte
- func (c *FHContext) GetFile(fieldName string) (*multipart.FileHeader, error)
- func (c *FHContext) GetHeader(key string) string
- func (c *FHContext) GetHeaders() *simplehttp.RequestHeader
- func (c *FHContext) GetMethod() string
- func (c *FHContext) GetPath() string
- func (c *FHContext) GetQueryParam(key string) string
- func (c *FHContext) GetQueryParams() map[string][]string
- func (c *FHContext) JSON(code int, data interface{}) error
- func (c *FHContext) Request() *http.Request
- func (c *FHContext) Response() http.ResponseWriter
- func (c *FHContext) SSE(handler simplehttp.SSEHandler) error
- func (c *FHContext) SaveFile(file *multipart.FileHeader, dst string) error
- func (c *FHContext) SendFile(filepath string, attachment bool) error
- func (c *FHContext) Set(key string, value interface{})
- func (c *FHContext) SetContext(ctx context.Context)
- func (c *FHContext) SetHeader(key, value string)
- func (c *FHContext) SetRequestHeader(key, value string)
- func (c *FHContext) SetResponseHeader(key, value string)
- func (c *FHContext) Stream(code int, contentType string, reader io.Reader) error
- func (c *FHContext) String(code int, data string) error
- func (c *FHContext) Upgrade() (simplehttp.Websocket, error)
- type RouterGroup
- func (g *RouterGroup) DELETE(path string, handler simplehttp.HandlerFunc)
- func (g *RouterGroup) GET(path string, handler simplehttp.HandlerFunc)
- func (g *RouterGroup) Group(prefix string) simplehttp.Router
- func (g *RouterGroup) HEAD(path string, handler simplehttp.HandlerFunc)
- func (g *RouterGroup) OPTIONS(path string, handler simplehttp.HandlerFunc)
- func (g *RouterGroup) PATCH(path string, handler simplehttp.HandlerFunc)
- func (g *RouterGroup) POST(path string, handler simplehttp.HandlerFunc)
- func (g *RouterGroup) PUT(path string, handler simplehttp.HandlerFunc)
- func (g *RouterGroup) Static(prefix, root string)
- func (g *RouterGroup) StaticFile(path, filepath string)
- func (g *RouterGroup) Use(middleware ...simplehttp.Middleware)
- func (g *RouterGroup) WebSocket(path string, handler func(simplehttp.Websocket) error)
- type Server
- func (s *Server) DELETE(path string, handler simplehttp.HandlerFunc)
- func (s *Server) GET(path string, handler simplehttp.HandlerFunc)
- func (s *Server) Group(prefix string) simplehttp.Router
- func (s *Server) HEAD(path string, handler simplehttp.HandlerFunc)
- func (s *Server) OPTIONS(path string, handler simplehttp.HandlerFunc)
- func (s *Server) PATCH(path string, handler simplehttp.HandlerFunc)
- func (s *Server) POST(path string, handler simplehttp.HandlerFunc)
- func (s *Server) PUT(path string, handler simplehttp.HandlerFunc)
- func (s *Server) Shutdown(ctx context.Context) error
- func (s *Server) Start(address string) error
- func (s *Server) Static(prefix, root string)
- func (s *Server) StaticFile(path, filepath string)
- func (s *Server) Use(middleware ...simplehttp.Middleware)
- func (s *Server) WebSocket(path string, handler func(simplehttp.Websocket) error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Adapter ¶
func Adapter(handler simplehttp.HandlerFunc) fasthttp.RequestHandler
Adapter converts SimpleHttp HandlerFunc to fasthttp.RequestHandler
func MiddlewareAdapter ¶
func MiddlewareAdapter(middleware simplehttp.MiddlewareFunc) func(fasthttp.RequestHandler) fasthttp.RequestHandler
MiddlewareAdapter converts SimpleHttp Middleware to fasthttp middleware
func URIString2URL ¶
Convert fasthttp URI to net/url skipping the error!
Types ¶
type FHContext ¶
type FHContext struct {
// contains filtered or unexported fields
}
func NewContext ¶
func NewContext(ctx *fasthttp.RequestCtx) *FHContext
func (*FHContext) BindJSON ¶
JSON-specific binding with memory optimization. This is only to get payload from Request Body!
func (*FHContext) GetFile ¶
func (c *FHContext) GetFile(fieldName string) (*multipart.FileHeader, error)
func (*FHContext) GetHeaders ¶
func (c *FHContext) GetHeaders() *simplehttp.RequestHeader
func (*FHContext) GetQueryParam ¶
func (*FHContext) GetQueryParams ¶
func (*FHContext) Response ¶
func (c *FHContext) Response() http.ResponseWriter
func (*FHContext) SSE ¶ added in v0.0.8
func (c *FHContext) SSE(handler simplehttp.SSEHandler) error
SSE starts a Server-Sent Events stream
func (*FHContext) SaveFile ¶
func (c *FHContext) SaveFile(file *multipart.FileHeader, dst string) error
func (*FHContext) SetContext ¶
func (*FHContext) SetRequestHeader ¶
func (*FHContext) SetResponseHeader ¶
type RouterGroup ¶
type RouterGroup struct {
// contains filtered or unexported fields
}
RouterGroup implements group routing
func (*RouterGroup) DELETE ¶
func (g *RouterGroup) DELETE(path string, handler simplehttp.HandlerFunc)
func (*RouterGroup) GET ¶
func (g *RouterGroup) GET(path string, handler simplehttp.HandlerFunc)
func (*RouterGroup) Group ¶
func (g *RouterGroup) Group(prefix string) simplehttp.Router
func (*RouterGroup) HEAD ¶
func (g *RouterGroup) HEAD(path string, handler simplehttp.HandlerFunc)
func (*RouterGroup) OPTIONS ¶
func (g *RouterGroup) OPTIONS(path string, handler simplehttp.HandlerFunc)
func (*RouterGroup) PATCH ¶
func (g *RouterGroup) PATCH(path string, handler simplehttp.HandlerFunc)
func (*RouterGroup) POST ¶
func (g *RouterGroup) POST(path string, handler simplehttp.HandlerFunc)
func (*RouterGroup) PUT ¶
func (g *RouterGroup) PUT(path string, handler simplehttp.HandlerFunc)
func (*RouterGroup) Static ¶
func (g *RouterGroup) Static(prefix, root string)
func (*RouterGroup) StaticFile ¶
func (g *RouterGroup) StaticFile(path, filepath string)
func (*RouterGroup) Use ¶
func (g *RouterGroup) Use(middleware ...simplehttp.Middleware)
func (*RouterGroup) WebSocket ¶
func (g *RouterGroup) WebSocket(path string, handler func(simplehttp.Websocket) error)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(config *simplehttp.Config) *Server
func (*Server) DELETE ¶
func (s *Server) DELETE(path string, handler simplehttp.HandlerFunc)
func (*Server) GET ¶
func (s *Server) GET(path string, handler simplehttp.HandlerFunc)
func (*Server) HEAD ¶
func (s *Server) HEAD(path string, handler simplehttp.HandlerFunc)
func (*Server) OPTIONS ¶
func (s *Server) OPTIONS(path string, handler simplehttp.HandlerFunc)
func (*Server) PATCH ¶
func (s *Server) PATCH(path string, handler simplehttp.HandlerFunc)
func (*Server) POST ¶
func (s *Server) POST(path string, handler simplehttp.HandlerFunc)
func (*Server) PUT ¶
func (s *Server) PUT(path string, handler simplehttp.HandlerFunc)
func (*Server) StaticFile ¶
func (*Server) Use ¶
func (s *Server) Use(middleware ...simplehttp.Middleware)
Click to show internal directories.
Click to hide internal directories.