Created
July 16, 2015 18:40
-
-
Save cianclarke/94e46ae719db255169fb to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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