Giter VIP home page Giter VIP logo

fancy-todo's Introduction

fancy-todo

by Henarivan Andhika Abhirama

Postman Documentation

For a more precise request of a certain status, check link below Link to postman documentations: https://documenter.getpostman.com/view/10571131/SzKbKuJS

GET /todos

Get all todos that the user have

Properties

  • token (String)

Request Header

{
   "token" : "<your_token>" 
}

Response

Status 200

[
  {
    "id": 75,
    "title": "wewafd",
    "description": "wew",
    "status": "Not Started",
    "due_date": "2020-03-08",
    "createdAt": "2020-03-07T04:05:58.726Z",
    "updatedAt": "2020-03-07T04:19:02.101Z",
    "UserId": 6
  },
  {
    "id": 76,
    "title": "Berhasil diedit",
    "description": "Membuat route sesuai REST dan membuat dokumentasi",
    "status": "Not Started",
    "due_date": "2020-03-04",
    "createdAt": "2020-03-07T04:10:58.064Z",
    "updatedAt": "2020-03-07T04:44:03.927Z",
    "UserId": 6
  },
  {
    "id": 77,
    "title": "Belajar gituan",
    "description": "gituan apa si",
    "status": "Not Started",
    "due_date": "2020-03-08",
    "createdAt": "2020-03-07T04:36:08.958Z",
    "updatedAt": "2020-03-07T04:36:08.958Z",
    "UserId": 6
  }
]

POST /todos

Create a todo

Properties

  • Title (String)
    • Can not be null or empty
  • Description (String)
    • Can not be null or empty
  • Due Date (String)
    • Can not be null or empty
    • YYYY/MM/DD format
  • Status (String)

User do not input a status as the status was set on default to 'Not Started'

Request Header

{
   "Content-Type": "application/json",
   "token" : "<your_token>" 
}

Response

Status 201

{
  "msg": "New Todo has been created",
  "newTodo": {
    "title": "Belajar gituan",
    "description": "gituan apa si",
    "due_date": "2020-03-08",
    "UserId": 6
  }
}

Status 400

{
  "status": 400,
  "msg": [
    "Validation errors (title can not be empty)"
  ]
}

GET /todos/:id


PUT /todos/:id

Update a todo by the id from the todos resources

Properties

  • id (Number)
    • Gotten from the client
  • Title (String)
    • Can not be null or empty
  • Description (String)
    • Can not be null or empty
  • Due Date (String)
    • Can not be null or empty
    • YYYY/MM/DD format
  • Status (String)

Request Headers

{
    "Content-Type": "application/json",
    "token" : "<your_token>"
}

Request Body

{
	"title" : "Berhasil diedit",
	"description" : "Membuat route sesuai REST dan membuat dokumentasi",
	"due_date" : "2020-03-04"
}

Response

Status (200)

{
  "msg": "Todo has been edited",
  "editedTodo": {
    "title": "Berhasil diedit",
    "description": "Membuat route sesuai REST dan membuat dokumentasi",
    "due_date": "2020-03-04"
  }
}

Status (400)

{
  "status": 400,
  "msg": [
    "Validation errors (title can not be empty)",
    "Validation errors (description can not be empty)",
    "Validation errors (due_date can not be empty)"
  ]
}

Status (403)

{
  "status": 403,
  "msg": "You are not authorized"
}

Status (404)

{
  "status": 404,
  "msg": "Todo not found"
}

DELETE /todos/:id

Delete a todo

Properties

  • id (Number)
    • Gotten from the client

Request Headers

{
    "Content-Type": "application/json",
    "token" : "<your_token>"
}

Response

Status (200)

{
  "id": 75,
  "title": "wewafd",
  "description": "wew",
  "status": "Not Started",
  "due_date": "2020-03-08",
  "createdAt": "2020-03-07T04:05:58.726Z",
  "updatedAt": "2020-03-07T04:19:02.101Z",
  "UserId": 6
}

Status (403)

{
  "status": 403,
  "msg": "You are not authorized"
}

Status (404)

{
  "status": 404,
  "msg": "Todo not found"
}

POST /register

Sign up an account

Properties

  • first_name (String)
    • Can not be null or empty
  • last_name (String)
    • Can not be null or empty
  • email (String)
    • Can not be null or empty
  • password (String)
    • Can not be null or empty

Request Headers

{
    "Content-Type": "application/json"
}

Request Body

{
	"first_name" : "Puji",
	"last_name" : "Yanto",
	"email" : "[email protected]",
	"password" : "qeqeqe"
}

Response

Status (201)

{
  "id": 16,
  "first_name": "Puji",
  "last_name": "Yanto",
  "email": "[email protected]",
  "password": "qeqeqe",
  "updatedAt": "2020-03-07T05:14:26.233Z",
  "createdAt": "2020-03-07T05:14:26.233Z"
}

Status (400)

{
  "status": 400,
  "msg": [
    "Validation errors (First Name can not be empty)",
    "Validation errors (Last name can not be empty)",
    "Validation errors (Email can not be empty)",
    "Validation errors (Password can not be empty)"
  ]
}

POST /login

Login to an account Generates a token for authentication

Properties

  • email (String)
  • password (String)

Request Headers

{
    "Content-Type": "application/json"
}

Request Body

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

Response

Status (200)

"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NiwiZW1haWwiOiJha2JhckBnbWFpbC5jb20iLCJpYXQiOjE1ODM1NTM1OTN9.pV44TwKKmaEKIwXgs5-JTLosad7HSji8gIvtWN4Acvs"

Status (400)

{
  "status": 400,
  "msg": "Wrong Email / Password"
}

POST /googleLogin

Login to an account with a google acount

Properties

  • Google Token (String)
    • Gotten from google sign-in server

Request Headers

{
    "Content-Type": "application/json"
}

Request Body

{
	"token" : "<token_from_google>"
}

Response

Status (200)

"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6OCwiZW1haWwiOiJoZW5hcml2YW5hYUBnbWFpbC5jb20iLCJpYXQiOjE1ODM1NTk5MjF9.q0qRNCzGxjC1TeqsaHxwqINnLu2FXRjTD3IulTJlzE8"

fancy-todo's People

Contributors

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