Documentation ¶
Index ¶
- type Logger
- type Request
- func (r *Request) Body(v interface{}) error
- func (r *Request) Json(status int, v interface{})
- func (r *Request) Origin() string
- func (r *Request) ParamValue(key string) string
- func (r *Request) Params() map[string][]string
- func (r *Request) Path() string
- func (r *Request) Redirect(forwardTo string)
- func (r *Request) Request() *http.Request
- func (r *Request) SendFile(file string)
- func (r *Request) SessionValue(key string) interface{}
- func (r *Request) SetSessionValue(key string, value interface{})
- func (r *Request) Vars() map[string]string
- func (r *Request) Writer() http.ResponseWriter
- type Router
- func (g *Router) ActivateProfiling()
- func (g *Router) Delete(path string, handler handlerFunc)
- func (g *Router) EnableAirbrake(airbrakeId int64, airbrakeKey string)
- func (g *Router) Get(path string, handler handlerFunc)
- func (g *Router) Post(path string, handler handlerFunc)
- func (g *Router) Put(path string, handler handlerFunc)
- func (g *Router) SubRoute(prefix string) Router
- func (g *Router) SubRouteC(prefix string, beforeFn beforeHandlerFunc) Router
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Request ¶
type Request struct { UserUuid string SessionInfo map[string]interface{} // contains filtered or unexported fields }
func NewRequest ¶
func NewRequest(w http.ResponseWriter, r *http.Request) Request
Create a new router.Request based on an http Request and ResponseWriter
func (*Request) Body ¶
Gets request body for PUT/POST requests and reads into the provided pointer. If the request header indicates a json body, decode the body as JSON into provided pointer.
func (*Request) Json ¶
Json sends json representation of the interface v with the provided status code to the client.
func (*Request) ParamValue ¶
ParamValue returns the first value of the given url param.
func (*Request) SessionValue ¶
SessionValue gets a key from the SessionInfo map.
func (*Request) SetSessionValue ¶
SetSessionValue allows us to set a value in the SessionInfo map. Initializes map if not already done.
func (*Request) Writer ¶
func (r *Request) Writer() http.ResponseWriter
Writer returns an http.ResponseWriter for the request. Can be used to output templated html and the like.
type Router ¶
type Router struct { // Inherit a mux router *muxtrace.Router // contains filtered or unexported fields }
func NewRouter ¶
NewRouter creates a new easyroute Router object with the provided before handler and logger struct
func (*Router) ActivateProfiling ¶
func (g *Router) ActivateProfiling()
func (*Router) EnableAirbrake ¶
func (*Router) SubRoute ¶
SubRoute creates a new easyroute Router off the base router with provided prefix. This preserves the same before handler.