kwand-stack
Version:
Koa + WebSockets + Angular + Node + Dokku
20 lines (16 loc) • 654 B
JavaScript
// use this to define 'locals' to be used in your jade templates at
// template compile time (when gulp runs first time, note this does
// not reload using livereload when changes are made to local.js)
console.log('Loading locals');
var moment = require('moment');
var request = require('request');
module.exports = function (cb) {
var weatherURI = 'http://api.openweathermap.org/data/2.5/weather?lat=35.481754&lon=-80.859718&units=imperial';
request(weatherURI, function(err,res,body) {
var blah = JSON.parse(body);
return cb(null,{
lastBuildDateLong: moment().format('MMMM Do YYYY, h:mm:ss a'),
weather: blah
});
});
}