wordnik/swagger-node-express — pull request #48 by jimkang (2013-04-18 00:01:34+00:00)
Title: Extra route callbacks

Sorry about the messiness, but there's only *one* change in this pull request. (Commits related to custom fields have been manually rolled back by commit 4dec464.) The change is support for adding more than one callback per Express route in an API endpoint's spec. For example:

'spec': {
'description' : 'Access an xAuth-protected resource',
'method' : 'POST',
'preliminaryCallbacks': [
passport.authenticate('consumer', {session: false}),
passport.authenticate('local', {session: false})
]
}

In this example the two callbacks specified in 'preliminaryCallbacks' will be called before the main API handler. Those callbacks could potentially handle the request before the main API callback is called. This is especially useful when using passportjs strategies to authenticate API endpoints.