Documentation ¶
Index ¶
- Variables
- type Context
- type D
- type Engine
- type Handler
- type Log
- type LogLevel
- type Middleware
- type Middlewares
- type Module
- type Param
- type Params
- type Render
- type Response
- type Router
- func (r *Router) Get(path string, handler Handler)
- func (r *Router) Group(relativePath string, middlewares ...Middleware) RouterObject
- func (r *Router) New(router func(*Router))
- func (r *Router) Post(path string, handler Handler)
- func (r *Router) ServeHTTP(writer http.ResponseWriter, request *http.Request)
- func (r *Router) Use(middlewares ...Middleware) RouterObject
- type RouterObject
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultErrorWriter io.Writer = os.Stderr
View Source
var Logger = &Log{}
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Engine ¶
type Engine struct { // Router is a http.Handler which can be used to dispatch requests to different // handler functions via configurable routes Router Router Module Module // contains filtered or unexported fields }
Engine is a framework's instance, this contains router, middleware and framework's settings Create and instance of Engine, by using New()
func (*Engine) GetHandler ¶
func (*Engine) SetLogLevel ¶
type Middleware ¶
type Middleware func(*Context)
type Middlewares ¶
type Middlewares []Middleware
type Render ¶
type Render interface {
// contains filtered or unexported methods
}
Render interface is to be implemented by JSON, XML, HTML, YAML and so on.
type Response ¶
type Response interface { http.ResponseWriter WriteContentType([]string) }
type Router ¶
type Router struct { BasePath string Middlewares Middlewares // contains filtered or unexported fields }
func (*Router) Group ¶
func (r *Router) Group(relativePath string, middlewares ...Middleware) RouterObject
Group is used to set the prefix of several routers and can also attach middleware to routers in the group.
func (*Router) New ¶
Add new router, this function will help to register routes using a function. This will helpful for manage routes for large application containing many routes
func (*Router) ServeHTTP ¶
func (r *Router) ServeHTTP(writer http.ResponseWriter, request *http.Request)
func (*Router) Use ¶
func (r *Router) Use(middlewares ...Middleware) RouterObject
Use attaches the middlewares to the router.
type RouterObject ¶
Click to show internal directories.
Click to hide internal directories.