Package middleware defines base type for context-aware HTTP request handler. See appengine/middleware for examples of how to use it in GAE environment.
WithContextTimeout returns a middleware that adds a timeout to the context.
WithPanicCatcher is a middleware that catches panics, dumps stack trace to logging and returns HTTP 500.
Base is a start of the middlware chain. It sets up initial context with all base services and passes it to the given handler. Return value of Base can be plugged in into httprouter directly.
TestingBase is Base that passes given context to the handler. Useful in tests.
Handler is the type for all request handlers. Of particular note, it's the same as httprouter.Handle, except that it also has a context parameter.
Middleware takes a handler, wraps it with some additional logic, and returns resulting handler.