Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrHandlerConfigIsNotFull will be returned if some handlers Config fields are not populated ErrHandlerConfigIsNotFull = errors.New("some handlers Config fields are not populated") // ErrServerConfigIsNotFull will be returned if some servers Config fields are not populated ErrServerConfigIsNotFull = errors.New("some servers Config fields are not populated") )
Functions ¶
func GetLimitAndOffsetParams ¶
GetLimitAndOffsetParams parses offset anf limit from url values
func NewBaseRouter ¶
func NewBaseRouter(h BaseHTTPHandler, serviceVersion, profilerPath string) (*mux.Router, error)
NewBaseRouter will return new router with already registered standard endpoints /swagger/swagger.yaml - to serve swagger schema /version.json - to serve service version /{profilerPath}/ - to serve http profiler
Types ¶
type BaseHTTPHandler ¶
type BaseHTTPHandler struct {
Logger logrus.FieldLogger
}
BaseHTTPHandler stores common dependencies and methods for any http api in system.
func (BaseHTTPHandler) NewLoggingResponseWriter ¶
func (h BaseHTTPHandler) NewLoggingResponseWriter(w http.ResponseWriter, r *http.Request) LoggingResponseWriter
NewLoggingResponseWriter creates new loggingResponseWriter instance for particular request
type LoggingResponseWriter ¶
type LoggingResponseWriter interface { // WriteHeader will set and log response status code WriteHeader(code int) // WriteHeaderWithErr same as WriteHeader but also will set and log error with metadata WriteHeaderWithErr(code int, err error) // WriteJSON is a helper that will set corresponding content type, encode your data and log response WriteJSON(data interface{}) // WriteXML is a helper that will set corresponding content type, encode your data and log response WriteXML(data interface{}) }
LoggingResponseWriter describes methods of loggingResponseWriter helper
Click to show internal directories.
Click to hide internal directories.