Commit 6c5a31ff authored by Zach's avatar Zach
Browse files

connected to forcast.io 馃槃

parent 46590da3
.meteor/local
.meteor/meteorite
server/lib/secrets.js
......@@ -18,3 +18,4 @@ ecmascript # Enable ECMAScript2015+ syntax in app code
autopublish # Publish all data to the clients (for prototyping)
insecure # Allow all DB writes from clients (for prototyping)
http
Meteor.startup(function () {
process.env.API_KEY = 'bed7e55eda48440c2da713bdc5e93207';
});
if (Meteor.isClient) {
Meteor.call('weatherDataForLoc', '38.830295', '-77.307717', function(err, res){
console.log(res);
//Sends the result of the API call to the browser console, will change
});
Template.weather.helpers({
......@@ -13,4 +17,15 @@ if (Meteor.isServer) {
Meteor.startup(function () {
// code to run on server at startup
});
Meteor.methods({
'weatherDataForLoc': function (lat, long) {
//API_KEY is an environmental veriable, you can set it with a JS file in
// server/lib or in your server control panel.
var API_KEY = process.env.API_KEY;
var apiURL = 'https://api.forecast.io/forecast/' + API_KEY + '/' + lat + ',' + long;
var response = HTTP.get(apiURL).data;
return response;
}
});
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment