Documentation
¶
Index ¶
- type CookieJar
- type EntrySet
- type Handler
- type Options
- type Request
- func (r *Request) Body() string
- func (r *Request) Cookies() CookieJar
- func (r *Request) Header() http.Header
- func (r *Request) Host() string
- func (r *Request) IP() string
- func (r *Request) JSON(pointer interface{}) error
- func (r *Request) Method() string
- func (r *Request) Params() EntrySet
- func (r *Request) Path() string
- func (r *Request) Protocol() string
- func (r *Request) Query() url.Values
- func (r *Request) Request() *http.Request
- func (r *Request) Route() string
- func (r *Request) Secure() bool
- func (r *Request) Server() *Server
- func (r *Request) URL() *url.URL
- type Response
- func (r *Response) Bytes(body []byte) error
- func (r *Response) Cookie(cookie *http.Cookie)
- func (r *Response) DestroyCookie(cookie *http.Cookie)
- func (r *Response) End(statusCode int)
- func (r *Response) Ended() bool
- func (r *Response) File(path string) error
- func (r *Response) Header() http.Header
- func (r *Response) JSON(body interface{}) error
- func (r *Response) Locals() EntrySet
- func (r *Response) Redirect(url string)
- func (r *Response) Render(name string, data interface{}) error
- func (r *Response) Response() http.ResponseWriter
- func (r *Response) Server() *Server
- func (r *Response) String(body string) error
- type Router
- type Server
- func (s *Server) AddMiddleware(handler ...Handler)
- func (s *Server) AddRoute(path string, handler Handler)
- func (s *Server) Listen()
- func (s *Server) Middleware() []Handler
- func (s *Server) Options() *Options
- func (s *Server) Resource(path string) ([]byte, error)
- func (s *Server) ResourcePath(path string) string
- func (s *Server) Routes() map[string]Handler
- func (s *Server) Template(name string) (*template.Template, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CookieJar ¶
CookieJar is an abstraction of the []*http.Cookie slice.
type EntrySet ¶
EntrySet is a map of keys and their string values.
type Options ¶
type Options struct {
Host string `json:"host"` // optional, defaults to localhost
Port int `json:"port"` // optional, defaults to 80
Directory string `json:"directory"` // optional, relative to current working directory
FriendlyExtensions []string `json:"friendlyURLs"` // remove extension requirement in url
TemplateExtensions []string `json:"templateExtension"` // which extension to associate with templates (.tmp is default)
Certificate string `json:"certificate"` // optional
Key string `json:"key"` // optional
}
Options are configurable server settings. All are optional and have default values.
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request is an abstraction of the http.Request.
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response is an abstraction of the http.ResponseWriter.
func (*Response) DestroyCookie ¶
DestroyCookie removes the provided cookie from the session.
func (*Response) File ¶
File responds with a resource relative to the server directory. An extension is required to get the MIME type.
func (*Response) Response ¶
func (r *Response) Response() http.ResponseWriter
Response returns the original http.ResponseWriter of the request.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server -
func (*Server) AddMiddleware ¶
AddMiddleware adds a new middleware to the server. The order in which middleware is added determines the execution order. Middleware will gets called before routing takes place.
func (*Server) Resource ¶
Resource fetches the raw bytes from a provided resource path. The path will be translated relative to specified the server directory.
func (*Server) ResourcePath ¶
ResourcePath fetches the relative to the requested file.