Documentation ¶
Index ¶
- func AssertHead(value string, assert func(head string) bool) (passed bool)
- func HasPrefix(value string, prefix string) bool
- func MarshalAndWriteJSON(responseWriter http.ResponseWriter, value interface{}) (err error)
- func MatchHead(value string, head string) (matched bool)
- func RenderAndWriteHTMLNode(responseWriter http.ResponseWriter, node *html.Node) (err error)
- func ShiftAndAssertHead(value string, assert func(head string) bool) (passed bool, tail string)
- func ShiftAndMatchHead(value string, head string) (matched bool, tail string)
- func ShiftHead(value string) (head, tail string)
- func WriteFile(responseWriter http.ResponseWriter, name string, data []byte)
- func WriteHTML(responseWriter http.ResponseWriter, html []byte)
- func WriteJSON(responseWriter http.ResponseWriter, json []byte)
- type ContextValues
- type ErrorHandler
- type Filter
- type Handler
- type Middleware
- type Page
- type ResponseMethods
- type Server
- type Website
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalAndWriteJSON ¶
func MarshalAndWriteJSON(responseWriter http.ResponseWriter, value interface{}) (err error)
func RenderAndWriteHTMLNode ¶
func RenderAndWriteHTMLNode(responseWriter http.ResponseWriter, node *html.Node) (err error)
func ShiftAndAssertHead ¶
func ShiftAndMatchHead ¶
func WriteHTML ¶
func WriteHTML(responseWriter http.ResponseWriter, html []byte)
func WriteJSON ¶
func WriteJSON(responseWriter http.ResponseWriter, json []byte)
Types ¶
type ContextValues ¶
type ContextValues map[interface{}]interface{}
func (ContextValues) Del ¶
func (contextValues ContextValues) Del(key interface{})
func (ContextValues) Get ¶
func (contextValues ContextValues) Get(key interface{}) interface{}
func (ContextValues) Set ¶
func (contextValues ContextValues) Set(key, value interface{})
type ErrorHandler ¶
type ErrorHandler func(Server, http.ResponseWriter, *http.Request, interface{})
type Middleware ¶
type Page ¶
func (*Page) MarshalMap ¶
func (*Page) WriteToBytes ¶
func (*Page) WriteToResponse ¶
func (page *Page) WriteToResponse(responseWriter http.ResponseWriter) (err error)
type ResponseMethods ¶
type ResponseMethods interface { WriteJSON(responseWriter http.ResponseWriter, json []byte) WriteHTML(responseWriter http.ResponseWriter, html []byte) }
type Server ¶
type Server interface { http.Handler ResponseMethods SetHandler(handler Handler) Server ContextValues() ContextValues // map[interface{}]interface{} AddFilters(filters ...Filter) Server AddMiddlewares(middlewares ...Middleware) Server // Match checks whether incoming *http.Request should be handled // by this server's handler. // // Match function will test request against all filters associated // with this server. If the request doesn't pass any one of them, // the Match function will return false. Otherwise, by default, // the Match function will return true. Match(request *http.Request) bool }
type Website ¶
type Website interface { GetRootFS() fs.FS GetDisableHTTPRedirect() bool GetStateGlobalName() string SetDisableHTTPRedirect(bool) SetStateGlobalName(string) NewPage(*http.Request) (*Page, error) MarshalStateMap(*Page) map[string]interface{} MarshalStateJS(*Page) (string, error) ServeHTTP(http.ResponseWriter, *http.Request) }
Click to show internal directories.
Click to hide internal directories.