Git Product home page Git Product logo

hex-todo-team's Introduction

Contributors Forks Stargazers Issues


hex-node-team

練習 TodoList RESTful API

View Demo

Table of Contents
  1. About The Project
  2. Usage
  3. Acknowledgments

About The Project

初學 Node.js 不使用框架建立 TodoList RESTful API

By Node.js 直播班 - 第八組

(back to top)

Built With

(back to top)

Usage

取得所有待辦事項

  • URL

    /todos

  • Method:

    GET

  • URL Params

    None

  • Data Params

    None

  • Success Response:

    • Code: 200
      Content:
      {
        "status":"SUCCESS",
        "data":[
          {
            "id":"uuid",
            "title":"example"
          }
          ,...
        ]
      }
      
  • Sample Call:

    curl --location --request GET 'https://demo.herokuapp.com/todos'

新增單筆待辦事項

  • URL

    /todos

  • Method:

    POST

  • URL Params

    None

  • Data Params

    • Content-Type: application/json
    {
        "title":"example"
    }
    
  • Success Response:

    • Code: 201
      Content:
      {
        "status":"SUCCESS",
        "data":[
          {
            "id":"uuid",
            "title":"example"
          }
          ,...
        ]
      }
      
  • Error Response:

    • Code: 400 Bad Request
      Content:
      {
        "status":"ERROR",
        "massage":"json parser error or other error"
      }
      

    OR

    • Code: 415 Unsupported Media Type
      Content:
      {
       "status":"ERROR",
       "massage":"資料結構錯誤"
      }
      
  • Sample Call:

    curl --location --request POST 'https://demo.herokuapp.com/todos' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "title":"example"
    }'

刪除所有待辦事項

  • URL

    /todos

  • Method:

    DELETE

  • URL Params

    None

  • Data Params

    None

  • Success Response:

    • Code: 200
      Content:
      {
        "status":"SUCCESS",
        "data":[]
      }
      
  • Sample Call:

    curl --location --request DELETE 'https://demo.herokuapp.com/todos'

刪除單筆待辦事項

  • URL

    /todos/:id

  • Method:

    DELETE

  • URL Params

    Required:

    id=[todoId]

  • Data Params

    None

  • Success Response:

    • Code: 200
      Content:
      {
        "status":"SUCCESS",
        "data":[
          {
            "id":"uuid",
            "title":"example"
          }
          ,...
        ]
      }
      
  • Error Response:

    • Code: 400 Bad Request
      Content:
      {
        "status":"ERROR",
        "massage":"json parser error or other error"
      }
      

    OR

    • Code: 404 Not Found
      Content:
      {
       "status":"ERROR",
       "massage":"待辦事項不存在"
      }
      
  • Sample Call:

    curl --location --request DELETE 'https://demo.herokuapp.com/todos/f35f2a71-e3f6-407c-a287-eff76f27c224'

編輯單筆待辦事項

  • URL

    /todos/:id

  • Method:

    PATCH

  • URL Params

    Required:

    id=[todoId]

  • Data Params

    None

  • Success Response:

    • Code: 200
      Content:
      {
        "status":"SUCCESS",
        "data":[
          {
            "id":"uuid",
            "title":"example"
          }
          ,...
        ]
      }
      
  • Error Response:

    • Code: 400 Bad Request
      Content:
      {
        "status":"ERROR",
        "massage":"json parser error or other error"
      }
      

    OR

    • Code: 404 Not Found
      Content:

      {
       "status":"ERROR",
       "massage":"待辦事項不存在"
      }
      

    OR

    • Code: 415 Unsupported Media Type
      Content:
      {
       "status":"ERROR",
       "massage":"資料結構錯誤"
      }
      
  • Sample Call:

    curl --location --request PATCH 'https://demo.herokuapp.com/todos/f0ad588a-c931-4612-8cad-ba5f6c969ff7' \
    --header 'Content-Type: application/json' \
    --data-raw '{
        "title":"example"
    }'

(back to top)

Acknowledgments

(back to top)

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.