Documentation ¶
Index ¶
- type CHC
- func (chc *CHC) AddRoute(route *Route)
- func (chc *CHC) AddRoutes(routes []*Route)
- func (chc *CHC) GetEnv(key string) string
- func (chc *CHC) Listen(host string, port int)
- func (chc *CHC) LoadEnv(filePath string)
- func (chc *CHC) NewJsonArray() []map[any]any
- func (chc *CHC) NewJsonObject() map[any]any
- func (chc *CHC) NewRoute() *Route
- func (chc *CHC) RequestLogging(logging bool)
- type Request
- type Response
- func (response *Response) GetImageBytes(filepath string) ([]byte, error)
- func (response *Response) LoadHtmlFile(filePath string) error
- func (response *Response) LoadImageFile(filePath string) error
- func (response *Response) SetCookie(key string, value string) *Response
- func (response *Response) SetHeader(key string, value string) *Response
- func (response *Response) SetJsonArrayBody(array []map[string]interface{}) error
- func (response *Response) SetJsonObjectBody(object map[string]interface{}) error
- func (response *Response) SetRedirect(url string) *Response
- func (response *Response) SetStatusCode(statusCode int) *Response
- func (response *Response) SetStringBody(body string) *Response
- type Route
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CHC ¶
func (*CHC) NewJsonArray ¶ added in v1.0.3
Make a new json array
func (*CHC) NewJsonObject ¶ added in v1.0.3
Make a new json object
func (*CHC) RequestLogging ¶
Turn Request Logging on or off (if using NewCHC function default is on, otherwise default is off)
type Request ¶
type Request struct { Method string URL string Protocol string Body string Params map[any]any Headers map[any]any Cookies map[any]any Conn net.Conn }
func (*Request) FormDataBody ¶
Parse the request body as Form Data and return the result as a map
func (*Request) JsonArrayBody ¶
Parse the request body as a JSON array and return the result as a map
type Response ¶
type Response struct { StatusCode int Body string Headers map[string]string Cookies map[string]string Conn net.Conn }
func (*Response) GetImageBytes ¶
Get the bytes from and image file
func (*Response) LoadHtmlFile ¶
Load a HTML file from a path and set the content type to text/html
func (*Response) LoadImageFile ¶
Set the response to an image from a path
func (*Response) SetJsonArrayBody ¶
Set the response body to a json array
func (*Response) SetJsonObjectBody ¶
Set the response body to a json object
func (*Response) SetRedirect ¶
Set the response redirect to a url
func (*Response) SetStatusCode ¶
Set the status code for the response
func (*Response) SetStringBody ¶
Set the response body to a string
type Route ¶
type Route struct { Path string Methods []string Headers map[any]any File string Controller func(request *Request, response *Response) (response_ *Response) Middlewares []func(response *Response) (response_ *Response, next bool) }
Click to show internal directories.
Click to hide internal directories.