Documentation ¶
Index ¶
- Constants
- type Config
- type Ctx
- func (ctx *Ctx) Bind(input interface{}) error
- func (ctx *Ctx) GetParam(name string) string
- func (ctx *Ctx) GetParams() map[string]string
- func (ctx *Ctx) GetQueryParam(name string) string
- func (ctx *Ctx) GetQueryParams() map[string]string
- func (ctx *Ctx) JSON(statusCode int, payload interface{}) error
- func (ctx *Ctx) Redirect(statusCode int, url string) error
- func (ctx *Ctx) Send(statusCode int, payload string) error
- func (ctx *Ctx) SendAttachment(filePath, fileName string) error
- func (ctx *Ctx) SendStatusCode(statusCode int) error
- func (ctx *Ctx) ServeFile(filePath string) error
- func (ctx *Ctx) UploadFile(filePath, fileName string) error
- type Group
- type Slide
- func (slide *Slide) Delete(path string, h ...handler)
- func (slide *Slide) Get(path string, h ...handler)
- func (slide *Slide) Group(path string) *Group
- func (slide *Slide) HandleErrors(h errHandler)
- func (slide *Slide) HandleNotFound(h handler)
- func (slide *Slide) Listen(host string) error
- func (slide *Slide) Post(path string, h ...handler)
- func (slide *Slide) Put(path string, h ...handler)
- func (slide *Slide) ServeFile(path, filePath string)
- func (slide *Slide) ServerDir(path, dir string)
- func (slide *Slide) Use(h handler)
Constants ¶
const ( GET = http.MethodGet POST = http.MethodPost PUT = http.MethodPut DELETE = http.MethodDelete ContentType = "Content-Type" ContentDeposition = "Content-Disposition" ApplicationJSON = "application/json" Attachment = "attachment" // cors headers HeaderOrigin = "Origin" HeaderVary = "Vary" HeaderAccessControlAllowOrigin = "Access-Control-Allow-Origin" HeaderAccessControlAllowMethods = "Access-Control-Allow-Methods" HeaderAccessControlAllowCredentials = "Access-Control-Allow-Credentials" HeaderAccessControlExposeHeaders = "Access-Control-Expose-Headers" HeaderAccessControlRequestMethod = "Access-Control-Request-Method" HeaderAccessControlRequestHeaders = "Access-Control-Request-Headers" HeaderAccessControlAllowHeaders = "Access-Control-Allow-Headers" HeaderAccessControlMaxAge = "Access-Control-Max-Age" // routing error messages NotFoundMessage = "Not Found, Check URL" )
...
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Validator *validator.Validate
}
Config -- Configuration for slide
type Ctx ¶
type Ctx struct { RequestCtx *fasthttp.RequestCtx Next func() error // contains filtered or unexported fields }
Ctx -- route level context
func (*Ctx) GetParam ¶
GetParam - Getting path param
/name/:name
/name/slide
name := ctx.GetParam("name")
name = slide
func (*Ctx) GetParams ¶
GetParams returns map of path params
routerPath /auth/:name/:age
requestPath /auth/madhuri/32
returns { name: madhuri, age: 32 }
func (*Ctx) GetQueryParam ¶
GetQueryParam returns value of a single query Param
route path /hello?key=test&value=bbp keyValue = GetQueryParam(key) keyValue = test
func (*Ctx) GetQueryParams ¶
GetQueryParams returns map of query Params
route path /hello?key=test&value=bbp returns {key : test, value : bbp}
func (*Ctx) Redirect ¶
Redirect to new url reference https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections#Temporary_redirections status codes between 300-308
func (*Ctx) SendStatusCode ¶
SendStatusCode -- sending response without any body
func (*Ctx) UploadFile ¶
UploadFile uploads file to given path
type Slide ¶
type Slide struct {
// contains filtered or unexported fields
}
Slide -- Slide config
func InitServer ¶
InitServer -- initializing server with slide config
func (*Slide) HandleErrors ¶
func (slide *Slide) HandleErrors(h errHandler)
HandleErrors Handling errors at application level
func (*Slide) HandleNotFound ¶
func (slide *Slide) HandleNotFound(h handler)
HandleNotFound custom 404 handler