strongloop/loopback-phase — pull request #6 by raymondfeng (2014-11-11 23:59:28+00:00)
Title: Add an option to create Phases that run handlers in serial

/to @ritch @bajtos

The PR adds an option (`options.serial`) to allow handlers in the same stage of a phase to be executed in serial and refactor the `run()` method to reduce number of closures.

Here is the issue that I ran into with oAuth2 component.

We have 3 middleware:
1. express session (create/restore req.session)
2. passport.initialize (sets req.session to req._passport.session)
3. passport.session (depends on 2)

All of them are session related and have to come in order. It makes sense to register 1 with `session` phase.
Then I have to squeeze 2&3 into `session:after`.

I could introduce more phases around session, such as 'session-creation', 'session-auth'. Just wonder if that would lead too many phases.