Skip to content

Instantly share code, notes, and snippets.

@briancavalier
Created August 8, 2012 21:05
Show Gist options
  • Save briancavalier/3298791 to your computer and use it in GitHub Desktop.
Save briancavalier/3298791 to your computer and use it in GitHub Desktop.
Hello wired for wire.js in node

Hello wire in node.js

  1. mkdir hello-wire
  2. cd hello-wire
  3. npm install wire
  4. Create main.js and spec.js as per the files in this gist.
  5. node main.js
// Load wire
var wire = require('wire');
// Use wire programmatically to wire the spec to produce
// a fully wired context.
wire(require('./spec')).then(function(context) {
console.log(context.message);
}, console.error);
// A wire spec is just an object literal. Not much interesting
// in this one, but enough to do hello world!
module.exports = {
message: "I haz been wired"
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment