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 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 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 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
| 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
| 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
| 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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> | |
| <title>freeCodeCamp.org</title> |
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
| 8. [Python] Object Oriented Programming in Python | |
| • Learn Python Basics by Building a Blackjack Game | |
| • Learn Intermediate Python by Building a Contact Book Program | |
| • Learn Object Oriented Programming by Building a Minesweeper Game | |
| • Learn Recursion by Solving the Tower of Hanoi Puzzle | |
| • Required Project: Pig Latin Translator | |
| • Required Project: Time Calculator | |
| • Required Project: Stack Calculator | |
| • Required Project: Budgeting App (using Object Oriented Programming) | |
| • Required Project: Area Calculator for Rectangles and Squares (using Object Oriented Programming) |