Skip to content

Instantly share code, notes, and snippets.

@bromanko
Created May 9, 2012 16:21
Show Gist options
  • Save bromanko/2646155 to your computer and use it in GitHub Desktop.
Save bromanko/2646155 to your computer and use it in GitHub Desktop.
Repl
#!/usr/bin/env node
require('coffee-script');
var env = require('./config/env')
, restify = require('restify')
, repl = require('repl').start()
, util = require('util');
repl.context.inspect = util.inspect;
repl.context.db = require('./models')(env.mongo_url);
var client = restify.createJsonClient({
url:env.hostname,
version:'*'
});
repl.context.client = client;
/* API Helpers */
repl.context.get = function(url) {
client.get(url, function(err, req, res, obj) {
if (err) console.error(err);
console.dir(obj);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment