Documentation
¶
Index ¶
- Constants
- func ServeStaticFile(dir string)
- type Dragon
- func (d *Dragon) Body(v interface{}) error
- func (d *Dragon) GetContext(key interface{}) interface{}
- func (d *Dragon) Next() error
- func (d *Dragon) ResponseHTML(statusCode int, v interface{}) error
- func (d *Dragon) ResponseJSON(statusCode int, v interface{}) error
- func (d *Dragon) ResponseJavaScript(statusCode int, v interface{}) error
- func (d *Dragon) ResponseStatus(statusCode int)
- func (d *Dragon) ResponseText(statusCode int, v interface{}) error
- func (d *Dragon) ResponseXML(statusCode int, v interface{}) error
- func (d *Dragon) SetContext(key interface{}, val interface{})
- type HandlerFunc
- type Router
Constants ¶
View Source
const ( PageNotFound = "page not found" MethodNotAllowed = "method not allowed" )
Variables ¶
This section is empty.
Functions ¶
func ServeStaticFile ¶
func ServeStaticFile(dir string)
ServeStaticFile will reading and serving index1.html file in specific folder as requested in argument
example :
r := dragon.NewRouter()
r.ServeHTTPFile("./static")
Types ¶
type Dragon ¶
type Dragon struct {
ResponseWriter http.ResponseWriter
Request *http.Request
Context context.Context
Params map[string]string
RequestHeader http.Header
ResponseHeader http.Header
Path string
Query url.Values
RemoteAddress string
}
func (*Dragon) GetContext ¶
func (d *Dragon) GetContext(key interface{}) interface{}
func (*Dragon) ResponseHTML ¶
func (*Dragon) ResponseJSON ¶
func (*Dragon) ResponseJavaScript ¶
func (*Dragon) ResponseStatus ¶
func (*Dragon) ResponseText ¶
func (*Dragon) ResponseXML ¶
func (*Dragon) SetContext ¶
func (d *Dragon) SetContext(key interface{}, val interface{})
type HandlerFunc ¶
type Router ¶
type Router interface {
GET(address string, handlerFunc HandlerFunc)
POST(address string, handlerFunc HandlerFunc)
PUT(address string, handlerFunc HandlerFunc)
PATCH(address string, handlerFunc HandlerFunc)
DELETE(address string, handlerFunc HandlerFunc)
Run(address string) error
Group(address string) router
Use(middleware ...HandlerFunc)
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
example
|
|
|
basic
command
|
|
|
middleware
command
|
|
|
paramURL
command
|
|
|
responseHTML
command
|
|
|
serveStaticFile
command
|
Click to show internal directories.
Click to hide internal directories.
