Skip to content

rfiestas/forecast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Forecast

A weather forecast written in Go ready to deploy on google cloud functions.

Wearher Forecast

Resources

  • Openweather, Simple and fast APIs. Access to current weather, forecasts, maps and historical data in JSON, XML, and HTML formats. A variety of map layers are available including precipitation, clouds, pressure, temperature, wind, and many more.
  • Mapquest, Build great location-based experiences and delight your customers with MapQuest for Business' geospatial solutions: mapping, geocoding, directions & search.
  • weather-icons, Weather Icons is the only icon font and CSS with 222 weather themed icons, ready to be dropped right into Bootstrap, or any project that needs high quality weather, maritime, and meteorological based icons!
  • Google Cloud Functions, Serverless application backends. Trigger your code from GCP services or call it directly from any web, mobile, or backend application.

Cloud Functions

  • Create a Openweather account, free plan offers 1,000 calls per day. Get the API Key
  • Create a Mapquest account, free plan offers FREE 15,000 transactions per month. Get the API Key
  • Log on Google cloud functions console,then create a project and 2 cloud functions.
Name Runtime Memory allocated Executed function Environment variables
index Go 1.11 128 MB ForecastAPIV1
forecast Go 1.11 128 MB GetIndex mapquest_key = YOUR KEY openweather_key = YOUR KEY

You can upload the go code to each cloud function or you can attach to a Google source cloud repository.

Also you can create cloud functions using gcloud sdk command line.

gcloud functions deploy index --entry-point "GetIndex" --runtime go111 --trigger-http --memory 128
gcloud functions deploy forecast --entry-point "ForecastAPIV1" --runtime go111 --trigger-http --memory 128 --set-env-vars "mapquest_key=**YOUR KEY**,openweather_key=**YOUR KEY**"

Now you project is ready on https://us-central1-PROJECT.cloudfunctions.net/index