balderdashy/sails — pull request #38 by curtislacy (2012-09-06 13:34:47+00:00)
Title: Hook to add an optional custom middleware to express.

How's this look to you? I added a check for a "customMiddleware" function in the config object, just before the router is added to express. Then I could do this in my configuration:

'customMiddleware': function() {
PassportService = require( './services/PassportAuthenticator' );
}

This makes my authentication service available as a global, and starts it early, while keeping it with the other services. I changed its name so that it wouldn't get started twice.