Created
May 19, 2011 14:41
-
-
Save billywhizz/980894 to your computer and use it in GitHub Desktop.
module configuration example
This file contains hidden or 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
// this is just a standard node.js module | |
exports.foo = function() { | |
return ("hello from " + process.ARGV[2]); | |
} |
This file contains hidden or 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
#!/usr/local/bin/node | |
// put all your standard requires in here and they will be available globally | |
global.mylib = require("./mylib"); | |
// remove this script from the arguments list | |
process.ARGV.slice(1,1); | |
module.load(process.ARGV[2], null, true); |
This file contains hidden or 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
// run with ./mynode ./test.js | |
console.log(mylib.foo()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment