http

package
Version: v0.0.0-...-b14964a Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(h ContextHandler) http.Handler

NewHandler returns an http.Handler which wraps the given ContextHandler and creates a background context.Context.

Types

type Config

type Config struct {
	Logger *logrus.Logger
}

Config configures a Server.

type ContextHandler

type ContextHandler interface {
	ServeHTTP(context.Context, http.ResponseWriter, *http.Request)
}

ContextHandler defines a handler which receives a passed context.Context with the standard ResponseWriter and Request.

type ContextHandlerFunc

type ContextHandlerFunc func(context.Context, http.ResponseWriter, *http.Request)

ContextHandlerFunc type is an adapter to allow the use of an ordinary function as a ContextHandler. If f is a function with the correct signature, ContextHandlerFunc(f) is a ContextHandler that calls f.

func (ContextHandlerFunc) ServeHTTP

func (f ContextHandlerFunc) ServeHTTP(ctx context.Context, w http.ResponseWriter, req *http.Request)

ServeHTTP calls the function f(ctx, w, req).

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server serves Todo's via HTTP.

func NewServer

func NewServer(config *Config) *Server

NewServer returns a new Server.

func (*Server) HTTPHandler

func (s *Server) HTTPHandler() http.Handler

HTTPHandler returns a HTTP handler for the server.

Jump to

Keyboard shortcuts

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