endpoint

package module
v0.0.0-...-c045886 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2015 License: MIT Imports: 3 Imported by: 3

README

endpoint

Build Status GoDoc

endpoint is an approach to the definition of routes and handlers with middleware and context. It was inspired by stack.

Usage

For usage, see the example.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context map[string]interface{}

Context is maps strings to arbitrary types

type Controller

type Controller func(Context) httprouter.Handle

Controller is a function that accepts a context and returns a handle.

type Endpoint

type Endpoint struct {
	Path         string
	Method       string
	Before       []Middleware
	RequiredArgs []string
	OptionalArgs []string
	Control      Controller
}

Endpoint is an endpoint on the server.

func (Endpoint) Handler

func (e Endpoint) Handler() httprouter.Handle

Handler joins the middleware with the controller.

type Middleware

type Middleware func(Context, httprouter.Handle) httprouter.Handle

Middleware is a function that accepts a context and a handler and returns a handle.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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