项目作者: kqarlos

项目描述 :
Track your most recent workouts
高级语言: JavaScript
项目地址: git://github.com/kqarlos/fitness-tracker.git
创建时间: 2020-02-02T16:54:40Z
项目社区:https://github.com/kqarlos/fitness-tracker

开源协议:MIT License

下载


Fitness Tracker



Languages
Top Language
Code Size
Repo Size
Total Lines
Express Version
Mongoose Version
Morgan Version
Last Commit
Issues
Followers

Description

Track your workouts with Fitness Tracker. The app will keep track of every exercise in your workout. The app dashboard will display weekly summary graphs of all workouts done in a week.

Table of Contents

Installation

  1. Clone repository.
  2. Check in routes/api-routes and comment in block of code if you want the database to be prepopulated with dummy values
  3. npm install
  4. node server.js

Running seeders/seed.js is optional to have a prepopulated database.


Live Site

Usage

Screeshots

  1. Homepage displaying last workout

Site

  1. Creating Workouts

Site

  1. Last Week’s Summary

Site

Snippets

  1. Adding to an array type
  1. // add exercise
  2. app.put("/api/workouts/:id", (req, res) => {
  3. db.Workout.findOneAndUpdate(
  4. { _id: req.params.id },
  5. {
  6. $inc: { totalDuration: req.body.duration },
  7. $push: { exercises: req.body }
  8. },
  9. { new: true }).then(dbWorkout => {
  10. res.json(dbWorkout);
  11. }).catch(err => {
  12. res.json(err);
  13. });
  14. });
  • This function will add an exercise to the array of exercises that belong to the workout with the given id. Here we will locate the workout with the given ID and update its fields. We will increase the total duration of the workout by the duration of the exercise being inserted. We will push the exercise to the array of exercises.

Credits

Author

Built With



HMTL
CSS
Javascript
Bootstrap
Node
Express
MongoDB

License



MIT license