Created
July 18, 2015 18:41
-
-
Save tiagobbraga/9c930044358ed00bde10 to your computer and use it in GitHub Desktop.
Module with params - Ref: http://stackoverflow.com/questions/13151693/passing-arguments-to-require-when-loading-module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (app, db) { | |
var module = {}; | |
module.auth = function (req, res) { | |
// This will be available 'outside'. | |
// Authy stuff that can be used outside... | |
}; | |
// Other stuff... | |
module.pickle = function(cucumber, herbs, vinegar) { | |
// This will be available 'outside'. | |
// Pickling stuff... | |
}; | |
function jarThemPickles(pickle, jar) { | |
// This will be NOT available 'outside'. | |
// Pickling stuff... | |
return pickleJar; | |
}; | |
return module; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment