Documentation
¶
Index ¶
- type Config
- type Cookie
- type Request
- type Response
- func (res *Response) DelCookie(name string)
- func (res *Response) Error(status [3]string)
- func (res *Response) Header(key string, value string)
- func (res *Response) Redirect(to string)
- func (res *Response) Send(body string)
- func (res *Response) SendFile(path string) error
- func (res *Response) SetCookie(c *Cookie)
- type Server
- func (s *Server) Get(path string, handler func(req *Request, res *Response))
- func (s *Server) Listen() error
- func (s *Server) ListenTLS(certificate string, key string) error
- func (s *Server) Post(path string, handler func(req *Request, res *Response))
- func (s *Server) Static(path string, realPath string)
- func (s *Server) Use(middleware func(req *Request, res *Response))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Host string Port int ReuseConn bool MaxReuseConn int Cache bool CacheMaxAge int }
Config type
type Cookie ¶
type Cookie struct { Name string Value string Path string Domain string Expires time.Time MaxAge string Secure bool HTTPOnly bool }
Cookie type
type Request ¶
type Request struct { Type string Path string Proto string Headers map[string]string Body map[string]string Params map[interface{}]interface{} }
Request type
type Response ¶
type Response struct { Proto string Statuscode int Statusmsg string Headers map[string]string status.Status // contains filtered or unexported fields }
Response type
type Server ¶
type Server struct { Host string Port int Socket net.Listener STATIC map[string]string Middleware []func(req *Request, res *Response) GET [][]interface{} POST [][]interface{} FileCache hmap.HashMap Config Config }
Server type
func (*Server) Get ¶
Get (path string, handler func(req *Request, res *Response)) appends given handler to GET routes
func (*Server) ListenTLS ¶
ListenTLS (certificate string, key string) listens for connections, and process it with tls
func (*Server) Post ¶
Post (path string, handler func(req *Request, res *Response)) appends given handler to POST routes
Click to show internal directories.
Click to hide internal directories.