Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func NormalizePort ¶
Types ¶
type Context ¶
type Context interface { // http objects GetRequest() *http.Request GetWriter() http.ResponseWriter // get data from request GetParam(key string) string GetQueryParam(key string) string GetAllowedOrigins() []string DecodeJSONBody(v interface{}) error // set data for response Status(status int) Context SetHeader(string, string) RawResponse(raw []byte) JSONResponse(data interface{}) // cookies SetCookie(cookie *http.Cookie) GetCookie(name string) (*http.Cookie, error) // logger Logger() *logrus.Logger }
type HandlerFunc ¶
type HandlerFunc func(Context)
type Middleware ¶
type Middleware func(HandlerFunc) HandlerFunc
This implementation of middleware will enable middleware chaining
type Server ¶
type Server interface { // Start and Stop Start() Shutdown() error // Middleware Use(Middleware) // HTTP methods Get(string, HandlerFunc) Post(string, HandlerFunc) Put(string, HandlerFunc) Delete(string, HandlerFunc) Patch(string, HandlerFunc) // GetRouter GetRouter() *httprouter.Router }
func NewServer ¶
func NewServer(config *ServerConfig) Server
NewServer creates a new server instance
Click to show internal directories.
Click to hide internal directories.