Created
June 6, 2012 17:59
-
-
Save paulallies/2883615 to your computer and use it in GitHub Desktop.
testing
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
var https = require('https'); | |
var test = ""; | |
var host = 'api.mongolab.com'; | |
var options = { | |
host: host, | |
port: 443, | |
path: "/", | |
method: 'GET' | |
}; | |
var YUI = require("yui").YUI; | |
exports.getListViaRequest = function(callback){ | |
options["path"] = '/api/1/databases/nano/collections/contacts?apiKey=4eaa9329e4b079327de623c7'; | |
https.request(options, function(res) { | |
res.on('data', function(d) { | |
test +=d; | |
callback(test) | |
}); | |
}).end(); | |
}; | |
exports.getListViaYUI = function(callback){ | |
var url = "https://api.mongolab.com/api/1/databases/nano/collections/contacts?apiKey=4eaa9329e4b079327de623c7"; | |
YUI().use('json','base', 'io', function(Y) { | |
Y.io(url, { | |
xdr: { | |
use: 'nodejs' | |
}, | |
on: { | |
start: function() { | |
Y.log('Start IO', 'info', 'TEST'); | |
}, | |
success: function(id, o) { | |
Y.log(Y.JSON.parse(o.responseText)); | |
}, | |
failure: function(){ | |
Y.log('Oops!'); | |
} | |
} | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment