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`
{middlewares, [
  my_middleware:setup([option, other_option]),
  cowboy_router,
  cowboy_handler
]}
```

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