server

package
v0.0.0-...-58f9d26 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2016 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCSRFToken

func AddCSRFToken(request *requests.Request)

AddCSRFToken generates a CSRF token and adds it into a response's cookie headers using the default name of CSRFToken. This function returns the value of the token for convenience.

func NewServer

func NewServer(router *Router) *http.Server

NewServer initializes a server to listen for http requests and returns it for user-initiated listening.

func RegisterMiddleware

func RegisterMiddleware(rh ...RequestHandler)

RegisterMiddleware registers middleware. Middleware request handlers are utilized in FIFO order.

Types

type RequestHandler

type RequestHandler func(*requests.Request)

RequestHandler type is the function signature required in order to register a new middleware request handler

type Router

type Router struct {
	PanicHandler     func(*requests.Request, interface{})
	NotFoundHandler  RequestHandler
	NotFoundRenderer rendering.Renderer
	// contains filtered or unexported fields
}

Router is an adapter for the httprouter.Router. DO NOT INSTANTIATE THIS MANUALLY! This struct is exported only for documentation purposes and you must use the factory method provided (NewRouter)

func NewRouter

func NewRouter(r *httprouter.Router) *Router

NewRouter returns a Router instance. If an *httprouter.Router instance is passed into NewRouter, the Router uses it, otherwise if it is nil the default is used

func (*Router) DELETE

func (r *Router) DELETE(path string, handle RequestHandler, renderer rendering.Renderer)

DELETE is the adapter for the httprouter DELETE shortcut. If renderer is not nil then the request will be rendered using that rendering agent

func (*Router) GET

func (r *Router) GET(path string, handle RequestHandler, renderer rendering.Renderer)

GET is the adapter for the httprouter GET shortcut. If renderer is not nil then the request will be rendered using that rendering agent

func (*Router) HEAD

func (r *Router) HEAD(path string, handle RequestHandler, renderer rendering.Renderer)

HEAD is the adapter for the httprouter HEAD shortcut. If renderer is not nil then the request will be rendered using that rendering agent

func (*Router) Handle

func (r *Router) Handle(method, path string, handle RequestHandler, renderer rendering.Renderer)

Handle is the adapter for birdnest routing to utilize httprouter's Handle method

func (*Router) OPTIONS

func (r *Router) OPTIONS(path string, handle RequestHandler, renderer rendering.Renderer)

OPTIONS is the adapter for the httprouter OPTIONS shortcut. If renderer is not nil then the request will be rendered using that rendering agent

func (*Router) PATCH

func (r *Router) PATCH(path string, handle RequestHandler, renderer rendering.Renderer)

PATCH is the adapter for the httprouter PATCH shortcut. If renderer is not nil then the request will be rendered using that rendering agent

func (*Router) POST

func (r *Router) POST(path string, handle RequestHandler, renderer rendering.Renderer)

POST is the adapter for the httprouter POST shortcut. If renderer is not nil then the request will be rendered using that rendering agent

func (*Router) PUT

func (r *Router) PUT(path string, handle RequestHandler, renderer rendering.Renderer)

PUT is the adapter for the httprouter PUT shortcut. If renderer is not nil then the request will be rendered using that rendering agent

func (*Router) ServeFiles

func (r *Router) ServeFiles(path string, root http.FileSystem)

ServeFiles is wrapper to set a static fileserver route onto the underlying httprouter.Router instance

func (*Router) ServeHTTP

func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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