Documentation ¶
Index ¶
- func Bootstrap(c []*Config)
- func GracefulShutdown()
- func ParseRequest(r *http.Request, i Request) error
- func ParseRequestBodyJSON(r *http.Request, v interface{}) error
- func ParseRequestParams(r *http.Request) map[string]string
- func ParseToll(r *http.Request) *toll.Toll
- func RespondErrorJSON(t *toll.Toll, w http.ResponseWriter, response interface{})
- func RespondJSON(t *toll.Toll, w http.ResponseWriter, response Response) error
- type Config
- type Request
- type Response
- type Rest
- func (rest *Rest) AddHandler(method, path string, handler http.Handler)
- func (rest *Rest) Handler(h http.HandlerFunc) http.HandlerFunc
- func (rest *Rest) HandlerWithMaxBodySize(h http.HandlerFunc, maxBodySize int64) http.HandlerFunc
- func (rest *Rest) ListenAndServe()
- func (rest *Rest) MethodNotAllowed(handler http.HandlerFunc)
- func (rest *Rest) NotFound(handler http.HandlerFunc)
- func (rest *Rest) Options(handler http.HandlerFunc)
- func (rest *Rest) Panic(handler func(http.ResponseWriter, *http.Request, interface{}))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseRequestBodyJSON ¶
func RespondErrorJSON ¶
func RespondErrorJSON(t *toll.Toll, w http.ResponseWriter, response interface{})
func RespondJSON ¶
Types ¶
type Config ¶
type Config struct { Addr string `json:"addr"` Pprof string `json:"pprof"` Health bool `json:"health"` MaxRequestBodyByte int64 `json:"maxRequestBodyByte"` ReadHeaderTimeoutSecond uint `json:"readHeaderTimeoutSecond"` ReadTimeoutSecond uint `json:"readTimeoutSecond"` WriteTimeoutSecond uint `json:"writeTimeoutSecod"` IdleTimeoutSecond uint `json:"idleTimeoutSecond"` CORSDomains []string `json:"corsDomains"` CORSHeaders []string `json:"corsHeaders"` // contains filtered or unexported fields }
type Rest ¶
type Rest struct {
// contains filtered or unexported fields
}
Rest represents rest server
func (*Rest) Handler ¶
func (rest *Rest) Handler(h http.HandlerFunc) http.HandlerFunc
func (*Rest) HandlerWithMaxBodySize ¶
func (rest *Rest) HandlerWithMaxBodySize(h http.HandlerFunc, maxBodySize int64) http.HandlerFunc
func (*Rest) MethodNotAllowed ¶
func (rest *Rest) MethodNotAllowed(handler http.HandlerFunc)
func (*Rest) NotFound ¶
func (rest *Rest) NotFound(handler http.HandlerFunc)
func (*Rest) Options ¶
func (rest *Rest) Options(handler http.HandlerFunc)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.