Created
April 17, 2012 01:17
-
-
Save kconragan/2402730 to your computer and use it in GitHub Desktop.
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 moment = require('moment'); | |
var request = require('request'); | |
exports.formatDate = function(format, date) { | |
}; | |
// Takes NDBC Buoy ID, and returns | |
// series of readings | |
var fetchBuoy = function(buoyId) { | |
request('http://www.ndbc.noaa.gov/data/5day2/' + buoyId + '_5day.txt', function(err, response, body){ | |
if(err || response.statusCode !== 200) { | |
return -1; | |
} | |
console.log(body); // this works | |
return body; // this returns undefined | |
}) | |
}; | |
exports.parseBuoyData = function(buoy) { | |
var buoys = fetchBuoy(buoy); | |
console.log(buoys); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment