express_sweater_weather's People
Forkers
hsmitha26express_sweater_weather's Issues
Removing Favorite Locations
Request:
DELETE /api/v1/favorites
Content-Type: application/json
Accept: application/json
body:
{
"location": "Denver, CO",
"api_key": "jgn983hy48thw9begh98h4539h4"
}
Response:
status: 204
Requirements:
- API key must be sent If no API key or an incorrect key is provided return 401 (Unauthorized)
Basic setup
-
npm install
-
npm install --save sequelize sequelize-cli pg
-
npx sequelize init
- Add
node_modules
to.gitignore
- Update
config/config.json
username (chakeresa
), database (express_sweater_weather_<environment>
), dialect (postgres
) - Add local setup instructions to the
README
Favoriting Locations
Request:
POST /api/v1/favorites
Content-Type: application/json
Accept: application/json
body:
{
"location": "Denver, CO",
"api_key": "jgn983hy48thw9begh98h4539h4"
}
Successful Response:
status: 200
body:
{
"message": "Denver, CO has been added to your favorites",
}
Requirements:
- API key must be sent
- If no API key or an incorrect key is provided return 401 (Unauthorized)
Listing Favorite Locations
Request:
GET /api/v1/favorites
Content-Type: application/json
Accept: application/json
body:
{
"api_key": "jgn983hy48thw9begh98h4539h4"
}
Response:
status: 200
body:
[
{
"location": "Denver, CO",
"current_weather": {
"summary": "Overcast",
"icon": "cloudy",
"precipIntensity": 0,
"precipProbability": 0,
"temperature": 54.91,
"humidity": 0.65,
"pressure": 1020.51,
"windSpeed": 11.91,
"windGust": 23.39,
"windBearing": 294,
"cloudCover": 1,
"visibility": 9.12,
},
"location": "Golden, CO",
"current_weather": {
"summary": "Sunny",
"icon": "sunny",
"precipIntensity": 0,
"precipProbability": 0,
"temperature": 71.00,
"humidity": 0.50,
"pressure": 1015.10,
"windSpeed": 10.16,
"windGust": 13.40,
"windBearing": 200,
"cloudCover": 0,
"visibility": 8.11,
}
}
]
Requirements:
- API key must be sent
- If no API key or an incorrect key is provided return 401 (Unauthorized)
Login
Request:
POST /api/v1/sessions
Content-Type: application/json
Accept: application/json
{
"email": "[email protected]",
"password": "password"
}
Response:
status: 200
body:
{
"api_key": "jgn983hy48thw9begh98h4539h4",
}
Add FavoriteLocations table / model
Get forecast given lat/long
Part of #5. Use Dark Sky API to fetch the forecast (given lat/long). Need currently/hourly/daily data.
Account Creation
Request:
POST /api/v1/users
Content-Type: application/json
Accept: application/json
{
"email": "[email protected]",
"password": "password"
"password_confirmation": "password"
}
Response:
status: 201
body:
{
"api_key": "jgn983hy48thw9begh98h4539h4",
}
For storing passwords in your database, we suggest looking into bcrypt.
Forecast for City
Request:
GET /api/v1/forecast?location=denver,co
Content-Type: application/json
Accept: application/json
body:
{
"api_key": "jgn983hy48thw9begh98h4539h4"
}
Response:
The response below is an example that gives only 1 object in the data array for both the hourly and daily. Your response should contain at least 8 hourly objects and 7 daily objects
{
"location": "Denver, C0",
"currently": {
"summary": "Overcast",
"icon": "cloudy",
"precipIntensity": 0,
"precipProbability": 0,
"temperature": 54.91,
"humidity": 0.65,
"pressure": 1020.51,
"windSpeed": 11.91,
"windGust": 23.39,
"windBearing": 294,
"cloudCover": 1,
"visibility": 9.12,
},
"hourly": {
"summary": "Partly cloudy throughout the day and breezy this evening.",
"icon": "wind",
"data": [
{
"time": 1555016400,
"summary": "Overcast",
"icon": "cloudy",
"precipIntensity": 0,
"precipProbability": 0,
"temperature": 54.9,
"humidity": 0.65,
"pressure": 1020.8,
"windSpeed": 11.3,
"windGust": 22.64,
"windBearing": 293,
"cloudCover": 1,
"visibility": 9.02,
},
]
},
"daily": {
"summary": "No precipitation throughout the week, with high temperatures bottoming out at 58°F on Monday.",
"icon": "clear-day",
"data": [
{
"time": 1554966000,
"summary": "Partly cloudy throughout the day and breezy in the evening.",
"icon": "wind",
"sunriseTime": 1554990063,
"sunsetTime": 1555036947,
"precipIntensity": 0.0001,
"precipIntensityMax": 0.0011,
"precipIntensityMaxTime": 1555045200,
"precipProbability": 0.11,
"precipType": "rain",
"temperatureHigh": 57.07,
"temperatureLow": 51.47,
"humidity": 0.66,
"pressure": 1020.5,
"windSpeed": 10.94,
"windGust": 33.93,
"cloudCover": 0.38,
"visibility": 9.51,
"temperatureMin": 53.49,
"temperatureMax": 58.44,
},
]
}
}
Requirements:
- API key must be sent
- If no API key or an incorrect key is provided return 401 (Unauthorized)
Modify output of GET forecast endpoint
- Format of the city, state is not quite per spec -- currently returns something like "Denver, CO, USA" or sometimes "Pueblo, TX, 76464, USA". Should be just "Denver, CO".
- Currently returning some extra data that is not required per the spec (like
dewPoint
&ozone
). - See
TODO
's inforecast.spec.js
Find better way to test database
shell.exec('npx sequelize db:migrate')
before/after every test is slow. There has to be a better way.
Deploy to Heroku
Require emails to be unique
Otherwise login can be impossible, even with the right password for one of the users.
Jest warning
Get the following warning when running jest -w=1 --detectOpenHandles
... Jest has detected the following 1 open handle potentially keeping Jest from exiting:
line 53 of create-user.specjs
-- test('missing password')
-- .post('api/v1/users)
.
All tests are passing and truly being run (can tell because they fail if I put something like expect(2).toEqual(4)
as the last line).
Get this issue when I run a single test for both jest -t 'missing password' --detectOpenHandles
and jest -t 'mismatched password' --detectOpenHandles
.
Ignoring for now because everything seems to be working OK anyway.
Get lat/long from 'denver,co'
Make a service to fetch the lat/long based on a string input of the location. Will use Google geocoding API. Needed for #5 (forecast for a city).
Store API keys securely
Need to figure out how to store API keys for Google geolocation & Dark Sky APIs securely. Needed for #5 (forecast for a city).
README
Include sections:
- Introduction
- Initial Setup
- How to Use
- Known Issues
- Running Tests
- How to Contribute
- Core Contributors
- Schema Design
- Tech Stack List
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.