Documentation
¶
Overview ¶
Package wood implements helpful tools that support the developer experience.
Index ¶
- func DefaultAssetServer(directory string) http.Handler
- func DefaultErrorReporter() func(error)
- func DefaultProtector() func(http.Handler) http.Handler
- func NewAssetServer(prefix, directory string) http.Handler
- func NewErrorReporter(out io.Writer) func(error)
- func NewProtector(maxBody string, corsOptions cors.Options) func(http.Handler) http.Handler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAssetServer ¶
DefaultAssetServer constructs an AssetServer that servers the directory on the root path.
func DefaultErrorReporter ¶
func DefaultErrorReporter() func(error)
DefaultErrorReporter returns a reporter that writes to stderr.
func DefaultProtector ¶
DefaultProtector constructs a middleware that by default limits the request body size to 8M and sets a basic CORS configuration.
Note: Place the protector as early as possible in the handler chain.
func NewAssetServer ¶
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 NewErrorReporter ¶
NewErrorReporter returns a very basic reporter that writes errors and stack traces to the specified writer.
func NewProtector ¶
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.
Note: Place the protector as early as possible in the handler chain.
Types ¶
This section is empty.