Strength-training tracking designed with the user in mind. Create, update, and review workouts in real time - with the user remaining in the driver seat for the control of their data.
benchMark Api is the backend for benchMark. To see benchMark in action, check out benchMark.
The benchMark frontend can be found at: benchMark-client
Here at benchmark we are strength-training enthusiasts. We understand the amount of stuff you carry at the gym as you work to break your limits. So we're here to help. benchMark is an easy solution allowing you to leave that pen and paper at home, and quickly log and track your workout progress in the same device that plays those tunes to keep you pumped up.
- Node and Express
- Authentication via JWT
- RESTful Api
- Testing
- Supertest (integration)
- Mocha and Chai (unit)
- Database
- Postgres
- Knex.js - SQL wrapper
Deployed via Heroku
- Postgres v8.3.3
- Node v15.11.0
Clone this repository to your local machine
git clone https://github.com/trevorjalt/benchmark-server benchmark-server
Change directory into the cloned repository
cd benchmark-server
Make a fresh start of the git history for this project
rm -rf .git && git init
Install the node dependencies
npm install
Create the development user
createuser -Pw --interactive
Type kakarot for the name of the role to add
Select y when asked if the user should be a super user
Press return (enter) for no password
Create the development databases
createdb -U kakarot benchmark && createdb -U kakarot benchmark-test
Create a .env file in the project root, and include the following:
NODE_ENV=development
PORT=8000
DB_URL=postgresql://kakarot@localhost/benchmark
TEST_DB_URL=postgresql://kakarot@localhost/benchmark-test
Start the Postgres server
pg_ctl start
Run the migrations for the development database
npm run migrate
Run the migrations for the development test database
npm run migrate:test
Seed the development database
psql -U kakarot -d benchmark -f ./seeds/seed.benchmark_tables.sql
Run the benchmark tests
npm t
Start the application
npm start
Start nodemon for the application
npm run dev
- endpoints
- /api/auth
- /api/user
- /api/workout
- /api/exercise
- /api/set
benchMark is supported by JWT authentication. A valid username and user_password must be posted to the /api/auth/login/ endpoint. This will return a bearer token that must be included in the header for all protected endpoints. To create a valid user, see /api/user/
POST
request body requires:
{
username: '',
user_password: '',
email: ''
}
request body supports an optional:
{
nickname: ''
}
POST
request body requires:
{
username: '',
user_password: ''
}
GET
Header must include a JWT Token
{
user_id: [number]
}
POST
Header must include a JWT Token
{
username: ''
}
GET
Header must include a JWT Token
request body requires:
{
user_id: [number]
}
POST
Header must include a JWT Token
request body requires:
{
user_id: [number]
}
GET
Header must include a JWT Token
request body requires:
{
workout_id: [number]
}
DELETE
Header must include a JWT Token
request body requires:
{
workout_id: [number]
}
GET
Header must include a JWT Token
request body requires:
{
user_id: [number]
}
POST
Header must include a JWT Token
request body requires:
{
workout_id: [number],
exercise_name: ''
}
GET
Header must include a JWT Token
request body requires:
{
exercise_id: [number]
}
DELETE
Header must include a JWT Token
request body requires:
{
exercise_id: [number]
}
PATCH
Header must include a JWT Token
request body requires:
{
exercise_id: [number],
exercise_name: ''
}
request body supports an optional:
{
date_modified: [date]
}
GET
Header must include a JWT Token
request body requires:
{
user_id: [number]
}
POST
Header must include a JWT Token
request body requires:
{
exercise_id: [number],
set_weight: [number],
set_repetition: [number]
}
GET
Header must include a JWT Token
request body requires:
{
set_id: [number]
}
DELETE
Header must include a JWT Token
request body requires:
{
set_id: [number]
}
PATCH
Header must include a JWT Token
request body requires:
{
set_id: [number],
set_weight: [number],
set_repetition: [number]
}