/Exercise-Tracker

A REST API project to track exercises.

Primary LanguageJavaScriptMIT LicenseMIT

Exercise-Tracker

This is a full stack JavaScript application that allows users to track their exercises. Users can create an account, add exercises, and view their exercise logs. This project is built using Node.js, Express, MongoDB, and a simple frontend with HTML, CSS, and JavaScript.

Features

  • View all users
  • Create a new user
  • Add exercises for a user
  • View exercise logs for a user
  • Filter exercise logs by date range and limit the number of results

Getting Started

Prerequisites

  • Node.js and npm installed
  • MongoDB installed and running

Installation

  1. Clone the repository
git clone https://github.com/DestroyerV/Exercise-Tracker.git
  1. Navigate to the cloned repository
cd Exercise-Tracker
  1. Install dependencies
npm install
  1. Start the server
npm start
  1. Open http://localhost:3000 in your browser

API Endpoints

Get Users

GET /api/users

[
  {
    "username": "testUser",
    "_id": "5fb5853f734231456ccb3b05"
  },
  {
    "username": "testUser2",
    "_id": "5fb5853f734231456ccb3b06"
  }
]

Create User

POST /api/users

{
  "username": "testUser"
}

Add Exercise

POST /api/users/:_id/exercises

{
  "description": "Running",
  "duration": 30,
  "date": "2020-01-01"
}

Get Logs

GET /api/users/:_id/logs?[from][&to][&limit] [ ] = optional

{
  "username": "testUser",
  "count": 1,
  "_id": "5fb5853f734231456ccb3b05",
  "log": [{ "description": "test", "duration": 60, "date": "Mon Jan 01 1990" }]
}

Contributing

If you want to contribute to this project, please follow the contributing guidelines.

License

This project is licensed under the MIT license.