Documentation
¶
Index ¶
Constants ¶
View Source
const ( GET method = "GET" POST method = "POST" DELETE method = "DELETE" PUT method = "PUT" PATCH method = "PATCH" HEAD method = "HEAD" OPTIONS method = "OPTIONS" )
Variables ¶
This section is empty.
Functions ¶
func CreateRouter ¶
func CreateRouter(r []Route) methodRoutes
Types ¶
type AppConfig ¶
type AppConfig struct {
Routes methodRoutes // routes of the app
Middleware []Middleware // global middlewares
Headers []Header // global headers
Port string // port of the app | default value '8080'
NotFound func(ctx *Ctx) // func that handles NotFound requests
ServeStatic bool // if true, the app will serve static files on "/static"
Plugins []Plugin // structs that implements the Plugin interface and runs Init_plugin() before starting the server
}
type Ctx ¶
type Ctx = fasthttp.RequestCtx // alias for Ctx
type Middleware ¶
type Route ¶
type Route struct {
Path string // path
Method method // method (only one)
Handle func(ctx *Ctx) error // func that handles the route
Children []Route // children of the route (if the route isnt the root route) [all childrens inherit parents Middlewares and Headers ]
Error func(ctx *Ctx, err error) // func that handles errors of the route (if err returned on handle method will be invoked with the error in the parameters)
Middleware []Middleware // middlewares of the route
Headers []Header // headers
}
Click to show internal directories.
Click to hide internal directories.