Skip to content

Instantly share code, notes, and snippets.

@jeromeetienne
Created August 10, 2010 21:17
Show Gist options
  • Save jeromeetienne/518027 to your computer and use it in GitHub Desktop.
Save jeromeetienne/518027 to your computer and use it in GitHub Desktop.
node.js module fun
jerome@jmebox:/tmp/slotu$ cat A.js
var hello = 42;
exports.hello = hello;
jerome@jmebox:/tmp/slotu$ cat a.js
require('./A').hello = "hello";
jerome@jmebox:/tmp/slotu$ cat b.js
require("./a");
console.log(require("./A").hello);
jerome@jmebox:/tmp/slotu$ node b.js
hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment