Documentation ¶
Index ¶
- func RegisterRoutes(rtr *httprouter.Router, controller WebController)
- func SubscribeNatsRoutes(natsCon *natsio.Nats, queueName string, controllers NatsController)
- type BaseController
- func (bC *BaseController) AcceptsHtml(r *http.Request) bool
- func (bC *BaseController) AcceptsJson(r *http.Request) bool
- func (bC *BaseController) AcceptsXml(r *http.Request) bool
- func (bC *BaseController) QueryInt(r *http.Request, param string) (int, error)
- func (bC *BaseController) QueryInterfaceMap(r *http.Request, param string, target interface{}) (ifMap map[string]interface{})
- func (bC *BaseController) QueryMap(r *http.Request, param string) map[string]string
- func (bC *BaseController) SendsHtml(r *http.Request) bool
- func (bC *BaseController) SendsJson(r *http.Request) bool
- func (bC *BaseController) SendsXml(r *http.Request) bool
- type JsonController
- type NatsController
- type WebController
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterRoutes ¶
func RegisterRoutes(rtr *httprouter.Router, controller WebController)
Registers an array of route handlers to gorilla/mux
func SubscribeNatsRoutes ¶
func SubscribeNatsRoutes(natsCon *natsio.Nats, queueName string, controllers NatsController)
Types ¶
type BaseController ¶
type BaseController struct{}
func (*BaseController) AcceptsHtml ¶
func (bC *BaseController) AcceptsHtml(r *http.Request) bool
func (*BaseController) AcceptsJson ¶
func (bC *BaseController) AcceptsJson(r *http.Request) bool
func (*BaseController) AcceptsXml ¶
func (bC *BaseController) AcceptsXml(r *http.Request) bool
func (*BaseController) QueryInterfaceMap ¶
func (bC *BaseController) QueryInterfaceMap(r *http.Request, param string, target interface{}) (ifMap map[string]interface{})
Uses byrnedo/mapcast to turn query string map into a typed map.
type JsonController ¶
type JsonController struct {
BaseController
}
Controller with json helpers
func (*JsonController) Serve ¶
func (jC *JsonController) Serve(w http.ResponseWriter, data interface{})
Serve standard 200
func (*JsonController) ServeWithStatus ¶
func (jC *JsonController) ServeWithStatus(w http.ResponseWriter, data interface{}, status int)
Serve with custom status
type NatsController ¶
type WebController ¶
Click to show internal directories.
Click to hide internal directories.