README
HitYourStride API is a back-end application that aggregates all your run data from Strava
Development
Dependencies
- Ruby 2.5.3
- Bundler 2.0
- Postgres 11.5
Initialization
$ gem install bundler
$ bundle check || bundle install
Usages
Retrieve runs with the following optional filter parameters:
city
country
distance_max
distance_min
duration_max
duration_min
layoff_max
layoff_min
mile_pace
curl 'http://localhost:3000/api/v1/activities' \
-X GET \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
Retrieve fastest runs for a route
curl 'http://localhost:3000/graphql' \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"query": "{ fastestRunsForRoute(routeId: ROUTE-ID) { routeRank startDateLocal movingTime distance milePace } }"
}'
Retrieve all past run locations
curl 'http://localhost:3000/api/v1/locations' \
-X GET \
-H 'Content-Type: application/json' \
-H 'Accept: application/json'
Configuration
-
Start rails server
-
Run
ruby bin/strava_oauth_token
and then copy thecode
value from the URL to use in the next step -
Make a request for your access token:
curl -X POST https://www.strava.com/api/v3/oauth/token \
-d client_id=<ReplaceWithClientID> \
-d client_secret=<ReplaceWithClientSecret> \
-d code=<ReplaceWithCode> \
-d grant_type=authorization_code
- Update the access token in your .env
Deploy
-
While on master branch, make sure
public/
is empty. -
Navigate to front-end app and run
yarn build
. This will generate folder nameddist
. -
Copy all the files in
dist
back topublic
.
cp -r dist/* ../hit-your-stride-api/public
- Navigate to back-end app and create a new deploy branch.
git checkout -b heroku-deploy
- Commit the new front-end files.
git add public
git commit -m "deploy"
- Push this deploy branch to heroku as remote master branch.
git push -f heroku heroku-deploy:master
- After successful deploy, delete deploy branch.
git checkout master
git branch -D heroku-deploy
- Check out your newly deployed app!
heroku open