Giter Club home page Giter Club logo

todo2.0-react's Introduction

Full Stack To Do App

In this repository, you will use build a full stack To Do app using React, Node/Express, and MySQL.

Objectives

  • Build a database.
  • Build an API server.
  • Create a front end.

Setup

Dependencies

Run yarn on root folder to install dependencies related to Express.

cd client and run yarn install dependencies related to React.

Database Prep

Create .env file in project directory and add

DB_NAME=todos
DB_PASS=YOUR_PASSWORD

(replace YOUR_PASSWORD with your actual password)

Alternatively, you can rename the provided .env.example file to .env.

Type mysql -u root -p to access the MySQL CLI using your password.

In the MySQL CLI, type create database todos; to create a database in MySQL.

Run the following in the MySQL CLI: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YOUR_PASSWORD'; (replace YOUR_PASSWORD with your actual password)

Run node model/database.js in your TERMINAL, in the root folder of your project (not your MySQL CLI! Open a new terminal window for this). This will create a table called 'items' in your database.

Run Your Development Servers

  • Run yarn start in project directory to start the Express server on port 5000
  • cd client and run yarn start to start client server in development mode with hot reloading in port 3000.
  • Client is configured so all API calls will be proxied to port 5000 for a smoother development experience. Yay!
  • You can test your client app in http://localhost:3000
  • You can test your API in http://localhost:5000/api

Basic Requirements

1. Read through all the current code and explain it to your partner.

  • Explain what each line of code is doing.
    • Look at the docs and ask your instructor if you aren't sure!

2. Finish the routes

Suggested Process:

  • Try and write the correct query in mysql.
  • Use that query to finish the endpoint in routes/api.js.
  • Test your endpoint using Postman.

To Do:

  • Use Postman to confirm that you have completed these correctly
  • GET /api/todos should retrieve all resources.
    • This route is almost complete!
  • POST /api/todos should create a new resource.
    • To test that your query is correct, check to see if your new resource exists using mysql.
    • To test your route, use Postman to see if GET api/todos returns your new resources.
  • PUT /api/todos/:id should replace a resource.
    • To test that your query is correct, check to see if your updated resource exists using mysql.
    • To test your route, use Postman to see if GET api/todos includes your updated resources.
  • DELETE /api/todos/:id should delete a resource.
    • To test that your query is correct, check to see if your resource was deleted using mysql.
    • To test your route, use Postman to see if GET api/todos does not include your new resources.

3. Finish the front end

  • Spend time reviewing the existing code in client/src/App.js.
  • Finish populating this.state.tasks from the API call in componentDidMount.
  • Then, add a list of tasks to the DOM. Each task should have the following:
    • The text of the task.
    • A strike through (using CSS) if the task is complete.
    • Two buttons:
      • One button to mark the task complete (this should call the updateTask method)
      • One button to delete the task (this should call the deleteTask method)
  • Finish the updateTask method so it calls the server.
  • Finish the deleteTask method so it calls the server.
  • Add styling.

Resources

Notes

This is a student project that was created at CodeOp, a full stack development bootcamp in Barcelona.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.