extend/cowboy — pull request #590 by CamShaft (2013-09-20 17:36:07+00:00)
Title: allow `fun`s to be passed as middleware

This allows one to return a fun from another function that
wraps the context of the application. For example:

```erlang
%% my_app.erl
{middlewares, [
my_middleware:setup([option, other_option]),
cowboy_router,
cowboy_handler
]}
```

```erlang
%% my_middleware.erl
-module(my_middleware).
-export(setup/1).
setup(Options) ->
% handle options
fun (Req, Env) ->
% Use the context from above
end.
```

Let me know if this makes sense. Thanks for looking at it!