https://github.com/jeremy-miller/weather
API server for retrieving the weather of a particular city
https://github.com/jeremy-miller/weather
tutorial
Last synced: 5 months ago
JSON representation
API server for retrieving the weather of a particular city
- Host: GitHub
- URL: https://github.com/jeremy-miller/weather
- Owner: jeremy-miller
- License: mit
- Created: 2017-07-20T04:36:39.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-02-28T06:00:05.000Z (over 8 years ago)
- Last Synced: 2024-06-20T12:49:09.033Z (almost 2 years ago)
- Topics: tutorial
- Language: Go
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/jeremy-miller/weather)
[](https://coveralls.io/github/jeremy-miller/weather?branch=master)
[](https://goreportcard.com/report/github.com/jeremy-miller/weather)
[](https://github.com/jeremy-miller/weather/blob/master/LICENSE)
[]()
# Weather
API server for retrieving the weather of a particular city.
This project is based on [this](http://howistart.org/posts/go/1/) tutorial.
## Table of Contents
- [Motivation](#motivation)
- [Usage](#usage)
- [Prerequisites](#prerequisites)
- [Build](#build)
- [Static Code Analysis](#static-code-analysis)
- [Test](#test)
- [Run](#run)
- [Example Call](#example-call)
- [License](#license)
## Motivation
I created this project to try Go.
## Usage
This implementation uses a Docker container to isolate the execution environment.
### Prerequisites
- [Docker](https://docs.docker.com/engine/installation/)
### Build
Before interacting with the weather server, the Docker container must be built: ```docker build -t jeremymiller/weather .```
### Static Code Analysis
To run the [vet](https://golang.org/cmd/vet/) static code analysis tool, execute the following command: ```docker run -it --rm jeremymiller/weather go tool vet *.go```
To run the [golint](https://github.com/golang/lint) code linter, execute the following command: ```docker run -it --rm jeremymiller/weather golint```
### Test
To run the Weather tests, execute the following command: ```docker run -it --rm jeremymiller/weather go test```
### Run
1. Start the weather server by executing the following command: ```docker run -it --rm -p 8080:8080 jeremymiller/weather```
2. Call the REST API for the city of your choice to `http://localhost:8080/weather/`
### Example Call
```
$ curl http://localhost:8080/weather/tokyo
{"city":"tokyo","temp":304.3,"took":"666.678077ms"}
```
*NOTE: The temperature is returned in Kelvin*
## License
[MIT](https://github.com/jeremy-miller/weather/blob/master/LICENSE)