Documentation ¶
Index ¶
- Constants
- Variables
- func GetKeyHandler(req *http.Request) (int, interface{})
- func Init(opts *Options, db storage.DB)
- func SetKeyHandler(req *http.Request) (int, interface{})
- func StatusHandler(req *http.Request) (int, interface{})
- type Middleware
- type NewEntry
- type Options
- type Server
- type SimpleHandler
Constants ¶
View Source
const (
JSONContentType = "application/json"
)
Variables ¶
View Source
var ( InvalidPort = errors.New("api: invalid port number 0") IPRegex = regexp.MustCompile("^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$") )
Functions ¶
func GetKeyHandler ¶
func SetKeyHandler ¶
func StatusHandler ¶
Types ¶
type Middleware ¶
func Accept ¶
func Accept(contentTypes ...string) Middleware
func Method ¶
func Method(methods ...string) Middleware
func Trace ¶
func Trace() Middleware
func WithContext ¶
func WithContext(values map[int]interface{}) Middleware
type Options ¶
type Server ¶
type Server struct { Opts *Options Mux *mux.Router Middlewares []Middleware }
func NewServer ¶
func NewServer(opts *Options, middlewares ...Middleware) *Server
func (*Server) Handle ¶
func (s *Server) Handle(route string, handler http.Handler, middlewares ...Middleware)
func (*Server) ListenAndServe ¶
type SimpleHandler ¶
func (SimpleHandler) ServeHTTP ¶
func (h SimpleHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.