zappajs/zappajs — pull request #62 by scien (2013-01-12 14:24:35+00:00)
Title: Pass request, response, next as parameters to middleware to support non-zappajs middleware

As is, the following will fail, because basicAuth (as most other middleware) expects the arguments (req, res, next) instead of having them being passed in the context.
```
require('zappajs') ->
connect = require 'connect'

auth = -> (user, pass) ->
user == 'hello' and pass == 'world'

@get '/', -> 'welcome'
@get '/auth', connect.basicAuth(auth), -> 'authenticated'
```

Currently you'd have to wrap the basicAuth middleware to pass in the context
```
require('zappajs') ->
connect = require 'connect'

auth = ->
fn = connect.basicAuth (user, pass) ->
user == 'hello' and pass == 'world'
fn @request, @response, @next

@get '/', -> 'welcome'
@get '/auth', auth, -> 'authenticated'
```