Find out if it will rain in Austin today! This is part 8 of the spring 2016 web workshops.
Web app that tells you if it will rain in Austin today. When a user makes a request, the Go server gets the forecast information as JSON, decodes it, and uses the precipitation probability to come up with a "yes" or "no" answer. The answer is rendered to the user using Go's built-in html template package.
- setting up a web server using the
net/http
package - using the
html/template
package to make simple HTML pages - error handling
- making HTTP requests, unmarshaling JSON using
encoding/json
Install Go.
Clone this repo and switch into it:
$ go get github.com/txcsmad/will-it-rain
$ cd $GOPATH/src/github.com/txcsmad/will-it-rain
Get a Forecast IO API key. Then set the environment variable:
$ export FORECASTIO_API_KEY=<your-api-key>
Run local server.
$ go build
$ ./will-it-rain
Then visit http://localhost:8080
- Nishanth Shanmugham email
- Brian Cui