This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express'); | |
| const app = express(); | |
| const port = 3000; | |
| let list = []; | |
| app.get('/', (req, res) => { | |
| res.json(list); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var http = require('http'); | |
| var fs = require('fs'); | |
| var path = require('path'); | |
| http.createServer(function (request, response) { | |
| console.log('request ', request.url); | |
| var filePath = './public' + request.url; | |
| if (filePath == './public/') { | |
| filePath = './public/index.html'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import DatePicker from 'react-datepicker'; | |
| import "react-datepicker/dist/react-datepicker.css"; | |
| import axios from 'axios'; | |
| export default class EditExercise extends Component { | |
| constructor(props) { | |
| super(props); | |
| this.onChangeUsername = this.onChangeUsername.bind(this); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const router = require('express').Router(); | |
| let Exercise = require('../models/exercise.model'); | |
| router.route('/').get((req, res) => { | |
| Exercise.find() | |
| .then(exercises => res.json(exercises)) | |
| .catch(err => res.status(400).json('Error: ' + err)); | |
| }); | |
| router.route('/add').post((req, res) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const router = require('express').Router(); | |
| let User = require('../models/user.model'); | |
| router.route('/').get((req, res) => { | |
| User.find() | |
| .then(users => res.json(users)) | |
| .catch(err => res.status(400).json('Error: ' + err)); | |
| }); | |
| router.route('/add').post((req, res) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const mongoose = require('mongoose'); | |
| const Schema = mongoose.Schema; | |
| const exerciseSchema = new Schema({ | |
| username: { type: String, required: true }, | |
| description: { type: String, required: true }, | |
| duration: { type: Number, required: true }, | |
| date: { type: Date, required: true }, | |
| }, { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const mongoose = require('mongoose'); | |
| const Schema = mongoose.Schema; | |
| const userSchema = new Schema({ | |
| username: { | |
| type: String, | |
| required: true, | |
| unique: true, | |
| trim: true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const express = require('express'); | |
| const cors = require('cors'); | |
| require('dotenv').config(); | |
| const app = express(); | |
| const port = process.env.PORT || 5000; | |
| app.use(cors()); | |
| app.use(express.json()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from 'react'; | |
| import DatePicker from 'react-datepicker'; | |
| import "react-datepicker/dist/react-datepicker.css"; | |
| export default class CreateExercise extends Component { | |
| constructor(props) { | |
| super(props); | |
| this.onChangeUsername = this.onChangeUsername.bind(this); | |
| this.onChangeDescription = this.onChangeDescription.bind(this); |