https://github.com/misterhtmlcss/eia-co2-api
https://github.com/misterhtmlcss/eia-co2-api
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/misterhtmlcss/eia-co2-api
- Owner: misterhtmlcss
- Created: 2020-10-05T19:39:45.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-10-10T20:41:53.000Z (over 5 years ago)
- Last Synced: 2025-01-24T09:09:31.110Z (over 1 year ago)
- Language: JavaScript
- Size: 199 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Purpose
- Play with EIA API
- Do something new with MongoDB
## Requirements
- Internet connection
- Nodejs v10.x
- NPM v\*
## How to install and run locally
- `node -v` check to make sure your version is correct; see above requirements
- `npm install`
- Add your API key into the .env-rename file
- Add your mongodb connection string into the .env-rename file
- Rename .env-rename to .env
- Dev `npm run dev` or Prod `npm start`
- States available for testing are:
- ```
{
name: "alabama",
label: "AL.A",
},
{
name: "alaska",
label: "AK.A",
},
{
name: "arizona",
label: "AZ.A",
},
{
name: "arkansas",
label: "AR.A",
},
{
name: "california",
label: "CA.A",
}
```
## Routes to test using Postman
- CO2 Emmissions from the year set in the params:
- [GET] `/api/v1/state?year=1980&state=alabama`
- CO2 Sum of emmissions between the years for the state set in the params:
- [GET] `/api/v1/tax?startYear=2003&endYear=2006&state=california`
- COS Emissions of the states targetted and the data is pushed to MongoDB:
- [GET] `/api/v1/local`
- [POST] `/api/v1/save?state1=alabama&state2=alaska&state3=california&state4=arizona`
## Caveats
- You'll need your own API Key from EIA
- You'll need your own MongDB Atlas Key
- It isn't configured to work in production
## Q&A
Who is this project for?
- No one. It's to meet a made up specification to test my ability to write a backend.
What is the performance criteria?
- None. As long as it runs and deploys then it's right.
# Author
- Roger Kondrat
- URL: rogerkondrat.com
- Twitter: @misterhtmlcss
- Last Updated: 07/10/2020 (DD/MM/YYYY)