web

package
v0.0.0-...-acccb75 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 24, 2016 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseMuxController

type BaseMuxController struct {
	ResponseRender
	UrlReverser
}

func (*BaseMuxController) GetTemplates

func (b *BaseMuxController) GetTemplates() []*render.TemplateSet

func (*BaseMuxController) SetResponseRender

func (b *BaseMuxController) SetResponseRender(r ResponseRender)

func (*BaseMuxController) SetUrlReverser

func (b *BaseMuxController) SetUrlReverser(r UrlReverser)

type DemoApi

type DemoApi struct {
	BaseMuxController
}

func (*DemoApi) MuxHandlers

func (api *DemoApi) MuxHandlers(m JsonMuxer)

type DemoController

type DemoController struct {
	BaseMuxController
}

func (*DemoController) GetTemplates

func (c *DemoController) GetTemplates() []*render.TemplateSet

func (*DemoController) MuxHandlers

func (c *DemoController) MuxHandlers(m JsonMuxer)

type JsonData

type JsonData struct {
	Status  string      `json:"status"`
	Payload interface{} `json:"payload"`
}

type JsonHandler

type JsonHandler func(ctx context.Context, w http.ResponseWriter, r *http.Request) (int, interface{})

type JsonMuxer

type JsonMuxer interface {
	server.Muxer
	GetJson(path string, name string, handle JsonHandler)
	PostJson(path string, name string, handle JsonHandler)
	PutJson(path string, name string, handle JsonHandler)
	PatchJson(path string, name string, handle JsonHandler)
	DeleteJson(path string, name string, handle JsonHandler)
}

type MuxController

type MuxController interface {
	MuxHandlers(m JsonMuxer)
	SetResponseRender(r ResponseRender)
	SetUrlReverser(r UrlReverser)
	GetTemplates() []*render.TemplateSet
}

type ResponseRender

type ResponseRender interface {
	RenderJsonOr500(w http.ResponseWriter, status int, v interface{})
	RenderHtmlOr500(w http.ResponseWriter, status int, name string, binding interface{})
	RenderServerError(w http.ResponseWriter, status int)
}

type Server

type Server struct {
	*server.Server
	// contains filtered or unexported fields
}

func NewServer

func NewServer(isDebug bool) (*Server, error)

func (*Server) Cleanup

func (s *Server) Cleanup()

func (*Server) DeleteJson

func (s *Server) DeleteJson(path string, name string, handle JsonHandler)

func (*Server) GetJson

func (s *Server) GetJson(path string, name string, handle JsonHandler)

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(addr string) error

func (*Server) PatchJson

func (s *Server) PatchJson(path string, name string, handle JsonHandler)

func (*Server) PostJson

func (s *Server) PostJson(path string, name string, handle JsonHandler)

func (*Server) PutJson

func (s *Server) PutJson(path string, name string, handle JsonHandler)

func (*Server) RenderHtmlOr500

func (s *Server) RenderHtmlOr500(w http.ResponseWriter, status int, name string, binding interface{})

func (*Server) RenderJsonOr500

func (s *Server) RenderJsonOr500(w http.ResponseWriter, status int, v interface{})

func (*Server) RenderServerError

func (s *Server) RenderServerError(w http.ResponseWriter, status int)

type UrlReverser

type UrlReverser interface {
	Reverse(name string, params ...interface{}) string
	Assets(path string) string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL