├── sample.env ├── .gitignore ├── .gitpod.yml ├── README.md ├── index.js ├── package.json ├── public └── style.css └── views └── index.html /sample.env: -------------------------------------------------------------------------------- 1 | PORT=3000 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | node_modules -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | image: gitpod/workspace-node-lts 2 | 3 | ports: 4 | - port: 3000 5 | onOpen: open-preview 6 | visibility: public 7 | 8 | tasks: 9 | - init: npm install 10 | command: npm run start 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Exercise Tracker 2 | 3 | This is the boilerplate for the Exercise Tracker project. Instructions for building your project can be found at https://www.freecodecamp.org/learn/apis-and-microservices/apis-and-microservices-projects/exercise-tracker 4 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const express = require('express') 2 | const app = express() 3 | const cors = require('cors') 4 | require('dotenv').config() 5 | 6 | app.use(cors()) 7 | app.use(express.static('public')) 8 | app.get('/', (req, res) => { 9 | res.sendFile(__dirname + '/views/index.html') 10 | }); 11 | 12 | 13 | 14 | 15 | 16 | const listener = app.listen(process.env.PORT || 3000, () => { 17 | console.log('Your app is listening on port ' + listener.address().port) 18 | }) 19 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fcc-exercise-tracker", 3 | "version": "0.1.0", 4 | "description": "A REST API project, part of Free Code Camp's curriculum", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node index.js" 8 | }, 9 | "dependencies": { 10 | "dotenv": "^8.2.0", 11 | "express": "^4.16.4", 12 | "cors": "^2.8.5" 13 | }, 14 | "repository": { 15 | "url": "https://github.com/freeCodeCamp/boilerplate-project-exercisetracker" 16 | }, 17 | "license": "MIT", 18 | "keywords": [ 19 | "node", 20 | "express" 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /public/style.css: -------------------------------------------------------------------------------- 1 | * { 2 | box-sizing: border-box; 3 | } 4 | 5 | body { 6 | font-family:sans-serif; 7 | margin: 25px; 8 | color: #222; 9 | background-color: #f5f5f5; 10 | } 11 | 12 | h1 { 13 | font-weight: bold; 14 | 15 | } 16 | 17 | p { 18 | max-width: 900px; 19 | } 20 | 21 | form { 22 | margin-bottom: 25px; 23 | padding: 15px; 24 | background-color: #87D37C; 25 | display: inline-block; 26 | width: 100%; 27 | max-width: 340px; 28 | border-radius: 5px; 29 | } 30 | 31 | input { 32 | display: block; 33 | margin-bottom: 10px; 34 | padding: 5px; 35 | width: 100%; 36 | border: 1px solid lightgrey; 37 | border-radius: 3px; 38 | font-size: 16px; 39 | } 40 | 41 | input[type=submit] { 42 | font-size: 16px; 43 | border-radius: 3px; 44 | background-color: #E4F1FE; 45 | border: 1px solid grey; 46 | box-shadow: 2px 2px #999; 47 | cursor: pointer; 48 | } 49 | 50 | input[type=submit]:hover { 51 | background-color: #FFFEC4; 52 | } 53 | 54 | code { 55 | font-family: monospace; 56 | font-size: 1.2em; 57 | background-color: #FFFEC4; 58 | padding: 2px; 59 | } 60 | -------------------------------------------------------------------------------- /views/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exercise Tracker | freeCodeCamp 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |

Exercise tracker

13 |
14 |

Create a New User

15 |

POST /api/users

16 | 17 | 18 |
19 |
20 |

Add exercises

21 |

POST /api/users/:_id/exercises

22 | 23 | 24 | 25 | 26 | 27 |
28 |

29 | GET user's exercise log: 30 | GET /api/users/:_id/logs?[from][&to][&limit] 31 |

32 |

[ ] = optional

33 |

from, to = dates (yyyy-mm-dd); limit = number

34 |
35 | 45 | 46 | 47 | --------------------------------------------------------------------------------