GithubHelp home page GithubHelp logo

ironhack-june-2020-react-cruder's Introduction

Models

Post Model

Schema:

{
  "content": {
    "type": String,
    "maxlength": 280,
    "required": true
  }
}

Route Handlers for REST API

METHOD  ENDPOINT/ACTION      DESCRIPTION

// Route handlers regarding posts
GET    -  '/post/list'        -  List all posts and send them as JSON to the client.
POST   -  '/post'             -  Handle post creation form submission. Send the created post in JSON response.
GET    -  '/post/:id'         -  Load single post and send them as JSON to the client.
DELETE -  '/post/:id'         -  Delete single post
PATCH  -  '/post/:id'         -  Handle post editing form submission, send the edited post as JSON.

// Route handlers regarding authentication
POST   -  '/authentication/sign-up'     - Handle sign up form submission.
POST   -  '/authentication/sign-in'     - Handle sign in form submission.
POST   -  '/authentication/sign-out'    - Handle sign out form submission.
GET    -  '/authentication/me'          - Load an the authenticated user

Explanation of request methods

GET - Load data. Should not mutate anything on the server or database. POST - Add data. Usually includes a request body. Mutate data on the server or database. DELETE - Delete data. Usually does not include a request body. Mutate data on the server or database. PATCH - Edit data. Usually includes a request body. Mutate data on the server or database. PUT - Replace data. Usually includes a request body. Mutate data on the server or database.

Client-side routes

'/' - Home view, calls service that lists all posts from REST API '/post/create' - Post creation view. Has form that, when submited, calls service to create post. '/post/:id' - Single Post view, calls service that loads single post from REST API '/post/:id/edit' - Edit Post view, calls service that loads single post from REST API. Has form that, when submited, calls service that edits specific post. Has second form that, when submited, calls service that deletes post.

ironhack-june-2020-react-cruder's People

Contributors

josecarneiro avatar

Watchers

 avatar  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.