http

package
v0.0.0-...-7fce639 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package http provides adapter implementations which run on top of http.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Components

type Components struct {
	Ctx log.Interface
}

Components makes instantiation easier to read

type Handler

type Handler interface {
	URL() string
	Handle(w http.ResponseWriter, req *http.Request) error
}

Handler defines endpoint-specific handler.

type Healthz

type Healthz struct{}

Healthz defines a handler to ping adapters via a GET request.

It listens to requests of the form: [GET] /healthz

func (Healthz) Handle

func (p Healthz) Handle(w http.ResponseWriter, req *http.Request) error

Handle implements the http.Handler interface

func (Healthz) URL

func (p Healthz) URL() string

URL implements the http.Handler interface

type Interface

type Interface interface {
	Bind(Handler)
}

Interface defines the public interfaces used by the adapter

func New

func New(c Components, o Options) Interface

New instantiates a new adapter

type Options

type Options struct {
	NetAddr string
	Timeout time.Duration
}

Options makes instantiation easier to read

type StatusPage

type StatusPage struct{}

StatusPage shows statistic on GET request

It listens to requests of the form: [GET] /status

No body or query param are expected

func (StatusPage) Handle

func (p StatusPage) Handle(w http.ResponseWriter, req *http.Request) error

Handle implements the http.Handler interface

func (StatusPage) URL

func (p StatusPage) URL() string

URL implements the http.Handler interface

Jump to

Keyboard shortcuts

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