Skip to content

Commit

Permalink
add README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
hehu80 committed Sep 13, 2024
1 parent 43cad6b commit 89f0d14
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ all: build
build:
@echo "Building..."

@go build -o main cmd/server/main.go
@go build cmd/server/main.go


# Run the application
Expand Down
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Air Pollution Service 🌱
A simple Go service that provides a RESTful API for retrieving emission and air pollution data for
all countries over the last 300 years. This microservice serves as a backend service that handles requests to
fetch historical environmental data, including CO₂ emissions, air pollutants, and other
environmental factors, for every country around the globe.

The required raw data can be downloaded here https://www.kaggle.com/datasets/rejeph/air-pollution.

## 🚀 Endpoints

## How to run
| Name | HTTP Method | Route |
|---------------------------------------------------|-------------|---------------------------|
| List all countries | GET | /countries |
| Returns a single country | GET | /countries/{name} |
| List all emissions of all countries for each year | GET | /emissions/year |
| List all emissions of all years for each country | GET | /emissions/country |
| List all emissions of a specific country | GET | /emissions/country/{name} |

### Locally
* Copy the raw data to a file, e.g. `/data/air-pollution.csv`.
* Point env variable `AIR_POLLUTION_FILE` to the file path.
* Run the service:
```bash
go build cmd/server/main.go
go go run cmd/server/main.go
```
2 changes: 1 addition & 1 deletion http-request-emissions.http
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ GET {{url}}:{{port}}/emissions/country/
# },
# ...
# }
GET {{url}}:{{port}}/emissions/country/Germany
GET {{url}}:{{port}}/emissions/country/Zimbabwe

0 comments on commit 89f0d14

Please sign in to comment.