Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.

Extra route callbacks #48

Closed
wants to merge 6 commits into from
Closed

Extra route callbacks #48

wants to merge 6 commits into from

Conversation

jimkang
Copy link

@jimkang jimkang commented Apr 18, 2013

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.

…API callback - to Express for a given route. The callbacks, which will be called before the API callback, can be specified in the spec property 'preliminaryCallbacks' as an array of Express middleware callbacks.
@fehguy
Copy link
Contributor

fehguy commented Dec 12, 2013

this PR should address your issue: #84

@fehguy fehguy closed this Dec 12, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants