Skip to content

Instantly share code, notes, and snippets.

@cianclarke
Created July 16, 2015 18:40
Show Gist options
  • Save cianclarke/94e46ae719db255169fb to your computer and use it in GitHub Desktop.
Save cianclarke/94e46ae719db255169fb to your computer and use it in GitHub Desktop.
var express = require('express');
var bodyParser = require('body-parser');
var cors = require('cors');
var request = require('request');
function helloRoute() {
var hello = new express.Router();
hello.use(cors());
hello.use(bodyParser());
hello.all('/', function(req, res) {
request({
url : 'http://api.openweathermap.org/data/2.5/weather?q=Waterford,Ireland',
json : true
}, function(error, response, body){
return res.json(body.main);
});
});
return hello;
}
module.exports = helloRoute;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment