This README provides an overview of the Crossfit WOD API, its structure, and how to set it up.
- Node.js installed
-
Clone the repository:
git clone <repository-url>
-
Navigate to the project directory:
cd <project-directory>
-
Install dependencies:
npm install
The API documentation is generated using Swagger and is available at http://localhost:3000/api/v1/docs. Explore the endpoints, parameters, and responses through the Swagger UI.
- Endpoint:
GET /api/v1/workouts
- Description: Get a list of workouts.
- Parameters:
mode
(optional): The mode of a workout.
- Responses:
200 OK
: Successful response with an array of workouts.5XX FAILED
: Failed response with an error message.
- Endpoint:
GET /api/v1/workouts/:workoutId
- Description: Get details of a specific workout.
- Parameters:
workoutId
: ID of the workout.
- Responses:
200 OK
: Successful response with details of the workout.5XX FAILED
: Failed response with an error message.
- Endpoint:
GET /api/v1/workouts/:workoutId/record
- Description: Get records for a specific workout.
- Parameters:
workoutId
: ID of the workout.
- Responses:
200 OK
: Successful response with records for the workout.5XX FAILED
: Failed response with an error message.
- Endpoint:
POST /api/v1/workouts
- Description: Create a new workout.
- Request Body Example:
{ "name": "New Workout", "mode": "For Time", "equipment": ["barbell", "rope"], "exercises": ["Exercise 1", "Exercise 2"], "trainerTips": ["Tip 1", "Tip 2"] }
- Responses:
200 OK
: Successful response with records for the workout.5XX FAILED
: Failed response with an error message.
- Endpoint: PATCH /api/v1/workouts/:workoutId
- Description: Update details of a specific workout.
- Parameters:
- workoutId: ID of the workout.
- Request Body Example:
{ "name": "Updated Workout", "mode": "AMRAP 10" }
- Responses:
200 OK
: Successful response with records for the workout.5XX FAILED
: Failed response with an error message.
- Endpoint: DELETE /api/v1/workouts/:workoutId.
- Description: Delete a specific workout.
- Parameters:
- workoutId: ID of the workout.
- Responses:
204 OK
: Successful response indicating the deletion.5XX FAILED
: Failed response with an error message.
- Endpoint: GET /api/v1/workouts/:workoutId/record
- Description: Get the record for a specific workout.
- Parameters:
- workoutId: ID of the workout.
- Responses:
200 OK
: Successful response with the record for the workout.5XX FAILED
: Failed response with an error message.