weather-info
Gets some basic weather info.
Setup:
npm install codeblox request
codeblox.json
{
"name": "weather-info",
"version": "1.0.0",
"description": "Gets weather info as a dictionary",
"keywords": [
"weather"
],
"input": "location",
"output": "dictionary"
}
.codebloxenv
WEATHER_API_KEY=YOUR_KEY_HERE
codeblox.js
const codeblox = require('codeblox')
const request = require('request')
module.exports.default = codeblox((input, options, callback) => {
request.get(`https://api.darksky.net/forecast/${process.env.WEATHER_API_KEY}/${input[0]},${input[1]}`, (err, res, body) => {
const weather = JSON.parse(body)
callback(null, {
Temperature: weather.currently.temperature,
Humidity: weather.currently.humidity,
'Wind Speed': weather.currently.windSpeed,
Visibility: weather.currently.visibility
})
})
})