Skip to content

Instantly share code, notes, and snippets.

@fibo
Created June 28, 2017 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fibo/1640aff00ea2ee0b24c5210ca3a1444b to your computer and use it in GitHub Desktop.
Save fibo/1640aff00ea2ee0b24c5210ca3a1444b to your computer and use it in GitHub Desktop.
meteo server yahoo weather
var express = require('express')
var weather = require('yahoo-weather')
var app = express()
app.get('/', (req, res) => {
res.send('hello')
})
app.get('/:city', (req, res) => {
weather(req.params.city).then((info) => {
// console.log(info)
res.json(info)
}).catch((err) => {
console.error(err)
res.sendStatus(400)
})
})
app.listen(80, () => {
console.log('server started')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment