Created
May 9, 2012 16:21
-
-
Save bromanko/2646155 to your computer and use it in GitHub Desktop.
Repl
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
#!/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