GithubHelp home page GithubHelp logo

udemy-cypress-react-todo-app's Introduction

Instructions to run the code locally

  • Clone the app into your machine.
  • Download json-server package globaly using npm install -g json-server.
  • Go to the directory of the app in the command line.
  • install all the dependences using npm install
  • Run the backend using npm run start:server
  • The server will be up and running on port 8080.
  • keep the server running and open another window from the terminal.
  • navigate to the directory of the app in the command line.
  • Start the front end using npm run start:frontend.
  • The app will be opened in your browser http://localhost:3000/

API Instructions

We Have 3 API end points:

Todos API:

and here is public API, any one can read, write, update and delete, and we use this API in our frontEnd.

details of this API:

  • GET all the todos: GET http://localhost:3000/todos

and this will return all the todos as below:

[
    {
        "name": "Study Cypress",
        "id": 1,
        "isComplete": true
    },
    {
        "name": "Play PES",
        "id": 2,
        "isComplete": false
    },
    {
        "name": "Contact Paul",
        "id": 3,
        "isComplete": true
    },
    {
        "name": "Go to the market",
        "id": 4,
        "isComplete": false
    }
]
  • GET one todo GET http://localhost:3000/todos?id=${id}

And this call will return one to do as below:

[
    {
        "name": "Study Cypress",
        "id": 1,
        "isComplete": true
    }
]
  • POST new todo POST http://localhost:3000/todos

and the body is:

{
    "name": "Study Cypress",
    "id": 1,
    "isComplete": false
}

And this call will return the newely added todo as below:

{
    "name": "study cypress",
    "isComplete": false,
    "id": 5
}
  • Update complete status for a todo:

PUT http://localhost:3000/todos/${id}

and the body is:

{
    "name": "Study Cypress",
    "id": 1,
    "isComplete": true
}

And this call will return the updated tasks:

{
    "name": "study Cypress",
    "isComplete": true,
    "id": 1
}
  • Delete a specific todo

DELETE http://localhost:3000/todos/${id}

And this will delete the todo

users API:

And here we can signup and login users

  • Signup a new user: POST http://localhost:3000/signup

and the body is

{
    "email": "[email protected]",
    "password": "bestPassw0rd",
    "firstname": "Olivier",
    "lastname": "Monge",
    "age": 32
}

This call will retuen the token as below:

{
    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6Im9saXZpZXJAbWFpbC5jb20iLCJpYXQiOjE2MTA1Njk0OTcsImV4cCI6MTYxMDU3MzA5Nywic3ViIjoiMSJ9.zapn_VZP2eBtRUy-9m_0EHGYFmsv2WYWJONSEv04tqA"
}
  • Login in a user POST http://localhost:3000/login

and the body is

{
    "email": "[email protected]",
    "password": "bestPassw0rd"
}

This call will retuen the token as below:

{
    "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6Im9saXZpZXJAbWFpbC5jb20iLCJpYXQiOjE2MTA1Njk0OTcsImV4cCI6MTYxMDU3MzA5Nywic3ViIjoiMSJ9.zapn_VZP2eBtRUy-9m_0EHGYFmsv2WYWJONSEv04tqA"
}

courses API:

  • Get all courses GET http://localhost:8080/courses

user must be logged in to get access to this course

udemy-cypress-react-todo-app

udemy-cypress-react-todo-app's People

Contributors

jakeaustinlewis avatar

Watchers

 avatar

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.