tools

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package tools implements various helpful tools for developing apps.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultAssetServer

func DefaultAssetServer(directory string) http.Handler

DefaultAssetServer constructs an AssetServer that servers the directory on the root path.

func DefaultProtector

func DefaultProtector() func(http.Handler) http.Handler

DefaultProtector constructs a middleware that by default limits the request body size to 4Ks and sets a basic CORS configuration.

func DefaultReporter added in v0.3.0

func DefaultReporter() func(error)

DefaultReporter returns a reporter that writes to stderr.

func DefaultRequestLogger

func DefaultRequestLogger() func(http.Handler) http.Handler

DefaultRequestLogger constructs a handler that logs incoming requests to the operating systems standard error output.

func NewAssetServer

func NewAssetServer(prefix, directory string) http.Handler

NewAssetServer constructs an asset server handler that serves an asset directory on a specified path and serves the index file for not found paths which is needed to run single page applications like Ember.

func NewProtector

func NewProtector(maxBody string, corsOptions cors.Options) func(http.Handler) http.Handler

NewProtector constructs a middleware that implements basic protection measures for the passed endpoint. Currently the protector limits the body size to a the passed length and automatically handles CORS using the specified options.

func NewReporter added in v0.3.0

func NewReporter(out io.Writer) func(error)

NewReporter returns a very basic reporter that writes errors and stack traces to the specified writer.

func NewRequestLogger

func NewRequestLogger(out io.Writer) func(http.Handler) http.Handler

NewRequestLogger constructs a handler that logs incoming requests to the specified writer output.

Types

This section is empty.

Jump to

Keyboard shortcuts

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