Documentation ¶
Index ¶
- type Connection
- type Server
- func (s *Server) Delete(path string, handler routeHandler)
- func (s *Server) Get(path string, handler routeHandler)
- func (s *Server) Listen(port int)
- func (s *Server) ListenAndWait(port int, wait bool)
- func (s *Server) NotFoundMessage(message string)
- func (s *Server) NotFoundPage(path string)
- func (s *Server) Post(path string, handler routeHandler)
- func (s *Server) Put(path string, handler routeHandler)
- func (s *Server) Route(path string, handler routeHandler)
- func (s *Server) Shutdown()
- func (s *Server) StaticFolder(path string, dir string)
- func (s *Server) ViewFolder(path string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct { R *http.Request W http.ResponseWriter Params map[string]string JSON interface{} // contains filtered or unexported fields }
Connection - struct for handling http request and write
func (*Connection) Redirect ¶
func (c *Connection) Redirect(path string)
Redirect - Redirect a request to another rest end point
func (*Connection) Render ¶
func (c *Connection) Render(path string, object interface{})
Render - Render HTML view with templating Templating uses standard library templating
func (*Connection) Send ¶
func (c *Connection) Send(message string)
Send - Return plain text string back to http request
func (*Connection) SendJSON ¶
func (c *Connection) SendJSON(object interface{})
SendJSON - Send json string back to client
func (*Connection) View ¶
func (c *Connection) View(path string)
View - Render HTML view without templating
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server - Individual instance of a rapid server
func (*Server) Listen ¶
Listen - Start webserver on specified port Returns the instance of the http server currently runing. You can use this instance to shutdown the server if need be.
func (*Server) ListenAndWait ¶
ListenAndWait - Gives user option of waiting for server or not
func (*Server) NotFoundMessage ¶
NotFoundMessage - Set the 404 message that users will see
func (*Server) NotFoundPage ¶
NotFoundPage - Set page to use for not found message
func (*Server) Shutdown ¶
func (s *Server) Shutdown()
Shutdown - Gracefully shut down the server and unblock the server thread.
func (*Server) StaticFolder ¶
StaticFolder - Specify application public/static folder
func (*Server) ViewFolder ¶
ViewFolder - Specifiy root folder to look for views/html files