Giter VIP home page Giter VIP logo

fancy-todo-1's Introduction

Fancy To-do

link deploy


Create a User

  • URL </users/register>

  • Method: POST

  • URL Params
    None

  • Data Params Required:

    name=[string]
    email=[string]
    password=[string]

    Optional: avatar=[string]

  • Sample Request:

    axios({
        "method": "POST",
        "url": "http://{HOST}.com/users/register",
        "data": {
            "name": "Mona Lisa",
            "email": "[email protected]",
            "password": "PASSWORD",
            "avatar": "https://images.unsplash.com/photo-1508214751196-bcfd4ca60f91?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80"
        }
    })
  • Success Response:

    • Code: 201
      Content:
          {
              "_id": "5e186c14af790e1a58535cdd",
              "name": "Mona Lisa",
              "email": "[email protected]",
              "avatar": "https://images.unsplash.com/photo-1508214751196-bcfd4ca60f91?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&w=1000&q=80",
              "createdAt": "2020-01-10T12:20:36.142Z",
              "updatedAt": "2020-01-10T12:20:36.142Z"
          }
  • Error Response:

    • Code: 400 Bad Request
      Content: { error : "This email [email protected] has already been used!" }
    • Code: 500 Internal Server Error
      Content: { error : "" }

Log In

  • URL </users/login>

  • Method: POST

  • URL Params
    None

  • Data Params Required:

    email=[string]
    password=[string]

  • Sample Request:

        axios({
            "method": "POST",
            "url": "http://{HOST}.com/users/login",
            "data": {
                "email": "[email protected]",
                "password": "PASSWORD"
            }
        })
  • Success Response:

    • Code: 200
      Content:
      {
          "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjVlMTg2YzE0YWY3OTBlMWE1ODUzNWNkZCIsImVtYWlsIjoibW9uYUBtYWlsLmNvbSIsImlhdCI6MTU3ODY2MTYyNywiZXhwIjoxNTc4NjY1MjI3fQ.NvyFqTB0WE5ZXlhU-rC2IidPDucoJNISLK7pNhumRmk"
      }
  • Error Response:

    • Code: 400 Bad Request
      Content: { error : "Email and/or password incorrect" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Find user by email

  • URL </users/{email}>

  • Method: GET

  • URL Params
    email=[string]

  • Request Headers
    Required: access_token=[string]

  • Data Params
    None

  • Sample Request:

        axios({
            "method": "GET",
            "url": "http://{HOST}.com/users/[email protected]",
            "headers": {
                "access_token": "YOUR_ACCESS_TOKEN"
            }
        })
  • Success Response:

    • Code: 200
      Content:
      {
          "_id": "5e15fe2ed406f210996d4f6a",
          "name": "John Doe",
          "email": "[email protected]",
          "avatar": "http://s3-eu-west-1.amazonaws.com/diy-magazine//diy/Artists/G/Girl-In-red/Girl-in-Red_-by-Chris-Almeida-1.png",
          "createdAt": "2020-01-08T16:07:10.388Z",
          "updatedAt": "2020-01-08T16:07:10.388Z"
      }
  • Error Response:

    • Code: 401 Unauthorized
      Content: { error : "You must log in first" }
    • Code: 404 Not Found
      Content: { error : "User not found" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Get all projects

  • URL </projects>

  • Method: GET

  • URL Params
    None

  • Request Headers
    Required: access_token=[string]

  • Data Params
    None

  • Sample Request:

    axios({
        "method": "GET",
        "url": "http://{HOST}.com/projects",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        }
    })
  • Success Response:

    • Code: 200
      Content:
      [
          {
              "members": [
                  {
                      "_id": "5e15fe2ed406f210996d4f6a",
                      "name": "Nana Nina",
                      "email": "[email protected]",
                      "avatar": "http://s3-eu-west-1.amazonaws.com/diy-magazine//diy/Artists/G/Girl-In-red/Girl-in-Red_-by-Chris-Almeida-1.png",
                      "createdAt": "2020-01-08T16:07:10.388Z",
                      "updatedAt": "2020-01-08T16:07:10.388Z"
                  }
              ],
              "_id": "5e15ff16d406f210996d4f70",
              "name": "Nana's First Project",
              "user": "5e15fe2ed406f210996d4f6a",
              "tasks": [],
              "createdAt": "2020-01-08T16:11:02.596Z",
              "updatedAt": "2020-01-08T16:11:02.596Z"
          },
          {
              "members": [
                  {
                      "_id": "5e15fe2ed406f210996d4f6a",
                      "name": "Nana Nina",
                      "email": "[email protected]",
                      "avatar": "http://s3-eu-west-1.amazonaws.com/diy-magazine//diy/Artists/G/Girl-In-red/Girl-in-Red_-by-Chris-Almeida-1.png",
                      "createdAt": "2020-01-08T16:07:10.388Z",
                      "updatedAt": "2020-01-08T16:07:10.388Z"
                  }
              ],
              "_id": "5e15ff1fd406f210996d4f71",
              "name": "Nana's Second Project",
              "user": "5e15fe2ed406f210996d4f6a",
              "tasks": [
                  {
                      "isDone": false,
                      "timeAllocation": 5,
                      "_id": "5e19974bdcc6b7242c12ba38",
                      "title": "Second Task",
                      "description": "This is my second task",
                      "dueDate": "2020-01-11T17:00:00.000Z",
                      "user": "5e15fe88d406f210996d4f6d"
                  }
              ],
              "createdAt": "2020-01-08T16:11:11.525Z",
              "updatedAt": "2020-01-08T16:11:11.525Z"
          }
      ]
  • Error Response:

    • Code: 401 Unauthorized
      Content: { error : "You must log in first" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Create a project

  • URL </projects>

  • Method: POST

  • URL Params
    access_token=[string]

  • Request Headers
    Required: access_token=[string]

  • Data Params Required: name=[string]

  • Sample Request:

    axios({
        "method": "POST",
        "url": "http://{HOST}.com/projects",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        },
        "data": {
            "name": "January Marketing Campaign"
        }
    })
  • Success Response:

    • Code: 201
      Content:
          {
              "members": [
                  "5e15fe88d406f210996d4f6d"
              ],
              "_id": "5e19468dc748361b9ef3d923",
              "name": "January Marketing Campaign",
              "user": "5e15fe88d406f210996d4f6d",
              "tasks": [],
              "createdAt": "2020-01-11T03:52:45.389Z",
              "updatedAt": "2020-01-11T03:52:45.389Z"
          }
  • Error Response:

    • Code: 400 Bad Request
      Content: { error : "Project's name is required" }
    • Code: 403 Forbidden
      Content: { error : "You must log in first" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Add a member to project

  • URL </projects/{id}/members>

  • Method: POST

  • URL Params
    id=[string]

  • Request Headers
    access_token=[string]

  • Data Params
    email=[string]

  • Sample Request:

    axios({
        "method": "POST",
        "url": "http://{HOST}.com/projects/5e19468dc748361b9ef3d923/members",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        },
        "data": {
            "email": "[email protected]"
        }
    })
  • Success Response:

    • Code: 200
      Content:
          {
              "members": [
                  "5e15fe88d406f210996d4f6d",
                  "5e186c14af790e1a58535cdd"
              ],
              "_id": "5e19468dc748361b9ef3d923",
              "name": "January Marketing Campaign",
              "user": "5e15fe88d406f210996d4f6d",
              "tasks": [],
              "createdAt": "2020-01-11T03:52:45.389Z",
              "updatedAt": "2020-01-11T08:33:45.285Z"
          }
  • Error Response:

    • Code: 403 Unauthorized
      Content: { error : "Unauthorized process" }
    • Code: 404 Not Found Request
      Content: { error : "Project not found" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Delete a member from project

  • URL </projects/{id}/members/{email}>

  • Method: DELETE

  • URL Params
    id=[string]
    email=[string]

  • Request Headers
    access_token=[string]

  • Data Params
    None

  • Sample Request:

    axios({
        "method": "DELETE",
        "url": "http://{HOST}.com/projects/5e19468dc748361b9ef3d923/members/[email protected]",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        }
    })
  • Success Response:

    • Code: 200
      Content:
          {
              "members": [
                  "5e15fe88d406f210996d4f6d"
              ],
              "_id": "5e19468dc748361b9ef3d923",
              "name": "January Marketing Campaign",
              "user": "5e15fe88d406f210996d4f6d",
              "tasks": [],
              "createdAt": "2020-01-11T03:52:45.389Z",
              "updatedAt": "2020-01-11T08:46:38.713Z"
          }
  • Error Response:

    • Code: 400 Bad Request
      Content: { error : "Can not delete project's owner" }
    • Code: 401 Unauthorized
      Content: { error : "Unauthorized process" }
    • Code: 404 Not Found Request
      Content: { error : "User not found" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Find a project

  • URL </projects/{id}>

  • Method: GET

  • URL Params
    id=[string]

  • Request Headers
    access_token=[string]

  • Data Params
    None

  • Sample Request:

    axios({
        "method": "GET",
        "url": "http://{HOST}.com/projects/5e19468dc748361b9ef3d923",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        }
    })
  • Success Response:

    • Code: 200
      Content:
          {
              "members": [
                  "5e15fe88d406f210996d4f6d"
              ],
              "_id": "5e19468dc748361b9ef3d923",
              "name": "January Marketing Campaign",
              "user": "5e15fe88d406f210996d4f6d",
              "tasks": [],
              "createdAt": "2020-01-11T03:52:45.389Z",
              "updatedAt": "2020-01-11T08:46:38.713Z"
          }
  • Error Response:

    • Code: 403 Unauthorized
      Content: { error : "Unauthorized process" }
    • Code: 404 Not Found
      Content: { error : "Resource not found" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Delete a project

  • URL </projects/{id}>

  • Method: DELETE

  • URL Params
    id=[string]

  • Request Headers
    access_token=[string]

  • Data Params
    None

  • Sample Request:

    axios({
        "method": "DELETE",
        "url": "http://{HOST}.com/projects/5e19468dc748361b9ef3d923",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        }
    })
  • Success Response:

    • Code: 200
      Content:
          {
              "message": "Project with ID 5e15fec7d406f210996d4f6f successfully deleted"
          }
  • Error Response:

    • Code: 403 Unauthorized
      Content: { error : "Unauthorized process" }
    • Code: 404 Not Found
      Content: { error : "Resource not found" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Add task to a project

  • URL </projects/{id}/tasks>

  • Method: POST

  • URL Params
    id=[string]

  • Request Headers
    access_token=[string]

  • Data Params
    Required: title=[string]

    Optional: description=[string]
    timeAllocation=[number]
    dueDate=[date]

  • Sample Request:

    axios({
        "method": "POST",
        "url": "http://{HOST}.com/projects/5e19468dc748361b9ef3d923/tasks",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        },
        "data": {
            "title": "First Task",
            "description": "This is my first task",
            "dueDate": "2020-01-12T17:00:00.000Z",
            "timeAllocation": 3
        }
    })
  • Success Response:

    • Code: 200
      Content:
          {
              "isDone": false,
              "timeAllocation": 3,
              "_id": "5e19974bdcc6b7242c12ba38",
              "title": "First Task",
              "description": "This is my first task",
              "dueDate": "2020-01-12T17:00:00.000Z",
              "user": "5e15fe88d406f210996d4f6d"
          }
  • Error Response:

    • Code: 400 Bad Request
      Content: { error : "Please insert title for the task" }
    • Code: 401 Unauthorized
      Content: { error : "Unauthorized process" }
    • Code: 404 Not Found /> Content: { error : "Resource not found" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Find a task

  • URL </projects/{id}/tasks/{taskId}>

  • Method: GET

  • URL Params
    id=[string]
    taskId=[string]

  • Request Headers
    access_token=[string]

  • Sample Request:

    axios({
        "method": "GET",
        "url": "http://{HOST}.com/projects/5e15febfd406f210996d4f6e/tasks/ 5e19974bdcc6b7242c12ba38",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        }
    })
  • Success Response:

    • Code: 200
      Content:
          {
              "isDone": false,
              "timeAllocation": 3,
              "_id": "5e19974bdcc6b7242c12ba38",
              "title": "First Task",
              "description": "This is my first task",
              "dueDate": "2020-01-12T17:00:00.000Z",
              "user": "5e15fe88d406f210996d4f6d"
          }
  • Error Response:

    • Code: 401 Unauthorized
      Content: { error : "Unauthorized process" }
    • Code: 404 Not Found
      Content: { error : "Resource not found" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Edit a task

  • URL </projects/{id}/tasks/{taskId}>

  • Method: PUT

  • URL Params
    id=[string]
    taskId=[string]

  • Request Headers
    access_token=[string]

  • Data Params
    Optional: title=[string]
    description=[string]
    dueDate=[date]
    timeAllocation=[number]

  • Sample Request:

    axios({
        "method": "PUT",
        "url": "http://{HOST}.com/projects/5e15febfd406f210996d4f6e/tasks/ 5e19974bdcc6b7242c12ba38",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        },
        "data": {
            "title": "Second Task",
            "description": "This is my second task",
            "timeAllocation": 5,
            "dueDate": 2020/01/11
        }
    })
  • Success Response:

    • Code: 200
      Content:
          {
              "isDone": false,
              "timeAllocation": 5,
              "_id": "5e19974bdcc6b7242c12ba38",
              "title": "Second Task",
              "description": "This is my second task",
              "dueDate": "2020-01-11T17:00:00.000Z",
              "user": "5e15fe88d406f210996d4f6d"
          }
  • Error Response:

    • Code: 400 Bad Request
      Content: { error : "Minimum time allocation is 1" }
    • Code: 401 Unauthorized
      Content: { error : "Unauthorized process" }
    • Code: 404 Not Found
      Content: { error : "Resource not found" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Update a task's status

  • URL </projects/{id}/tasks/{taskId}/done>

  • Method: PATCH

  • URL Params
    id=[string]
    taskId=[string]

  • Request Headers
    access_token=[string]

  • Sample Request:

    axios({
        "method": "PUT",
        "url": "http://{HOST}.com/projects/5e15febfd406f210996d4f6e/tasks/done",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        }
    })
  • Success Response:

    • Code: 200
      Content:
          {
              "isDone": done,
              "timeAllocation": 5,
              "_id": "5e19974bdcc6b7242c12ba38",
              "title": "Second Task",
              "description": "This is my second task",
              "dueDate": "2020-01-11T17:00:00.000Z",
              "user": "5e15fe88d406f210996d4f6d"
          }
  • Error Response:

    • Code: 401 Unauthorized
      Content: { error : "Unauthorized process" }
    • Code: 404 Not Found
      Content: { error : "Resource not found" }
    • Code: 500 Internal Server Error
      Content: { error : error }

Delete a task

  • URL </projects/{id}/tasks/{taskId}>

  • Method: DELETE

  • URL Params
    id=[string]
    taskId=[string]

  • Request Headers
    access_token=[string]

  • Sample Request:

    axios({
        "method": "DELETE",
        "url": "http://{HOST}.com/projects/5e15febfd406f210996d4f6e/tasks/ 5e19974bdcc6b7242c12ba38",
        "headers": {
            "access_token": "YOUR_ACCESS_TOKEN"
        }
    })
  • Success Response:

    • Code: 200
      Content:
          {
              "Task with ID 5e19974bdcc6b7242c12ba38 successfully deleted"
          }
  • Error Response:

    • Code: 401 Unauthorized
      Content: { error : "Unauthorized process" }
    • Code: 404 Not Found
      Content: { error : "Resource not found" }
    • Code: 500 Internal Server Error
      Content: { error : error }

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.