Skip to content

Instantly share code, notes, and snippets.

@paulallies
Created June 6, 2012 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulallies/2883615 to your computer and use it in GitHub Desktop.
Save paulallies/2883615 to your computer and use it in GitHub Desktop.
testing
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