Express Sweater Weather is a Express/Node.js API. This was a Turing School of Software and Design solo project completed over a 3 day sprint. It was designed as a first introduction to Express and Node.js.
- JavaScript
- Express
- Node.js
- Knex
GitHub Repo: (https://github.com/nathangthomas/express_sweater_weather) Live App: (https://winter-weather-express.herokuapp.com/)
git clone https://github.com/nathangthomas/express_sweater_weather.git
- Run
npm install
- Add a
.env
file in your root directory. Don't forget to include this file in your .gitignore. - Add the following API keys to the
.env
file:
GOOGLE_API_KEY=<your google api key here>
DARKSKY_API_KEY=<your darksky api key here>
- Run
psql
to get started setting up your database.CREATE DATABASE <database_name>_dev;
CREATE DATABASE <database_name>_test;
type \q to escape - Run
migrate:latest
andknex seed:run
to migrate and seed your database - Spin up the server by running
npm start
- The following are the endpoints available:
GET /api/v1/forecast?location=denver,co
(forecast for a city)POST /api/v1/favorites
(favoriting locations)GET /api/v1/favorites
(listing favorite locations)DELETE /api/v1/favorites
(removing favorite locations)
(all endpoints must be accompanied by an API Key assigned to your user in the database. This API key and all additional parameters must be passed in through the request body like the example below.)
POST /api/v1/favorites
Content-Type: application/json
Accept: application/json
body:
{
"location": "Denver, CO",
"api_key": "jgn983hy48thw9begh98h4539h4"
}
- Choose to use either the local server or live Heroku app in combination with Postman.