Skip to content

Membuat sebuah website untuk me-manage hal - hal menarik untuk dilakukan

Notifications You must be signed in to change notification settings

syukurbaru/fancy-todo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 

Repository files navigation

fancy-todo

My fancy-todo App is an application to manage your fancy-todo. This app has :

  • RESTful endpoint for todo's CRUD operation
  • JSON formatted response

 

RESTful endpoints

 

POST /todos

Create new todo

Request Header

{
  "access_token": "<your access token>"
}

Request Body

{
  "title": "<name to get insert into>",
  "description": "<description to get insert into>",
  "status": "<status to get insert into>",
  "due_date": "<due_date to get insert into>"
}

Response (201 - Created)

{
  "id": <given id by system>,
  "title": "<name to get insert into>",
  "description": "<description to get insert into>",
  "status": "<status to get insert into>",
  "due_date": "<due_date to get insert into>",
  "createdAt": "2020-03-20T07:15:12.149Z",
  "updatedAt": "2020-03-20T07:15:12.149Z"
}

Response (400 - Bad Request)

{
  "message": "Invalid requests"
}

Response (500 - Server Error)

{
  "message": "Internal server error"
}

GET /todos

Get all fancy-todo

Request Header

{
  "access_token": "<your access token>"
}

Request Body

not needed

Response (200)

[
  {
    "id": 1,
    "title": "<name to get insert into>",
    "description": "<description to get insert into>",
    "status": "<status to get insert into>",
    "due_date": "<due_date to get insert into>",
    "createdAt": "2020-03-20T07:15:12.149Z",
    "updatedAt": "2020-03-20T07:15:12.149Z",
  },
  {
    "id": 2,
    "title": "<name to get insert into>",
    "description": "<description to get insert into>",
    "status": "<status to get insert into>",
    "due_date": "<due_date to get insert into>",
    "createdAt": "2020-03-20T07:15:12.149Z",
    "updatedAt": "2020-03-20T07:15:12.149Z",
  }
]

Response (500 - Server Error)

{
  "message": "Internal server error"
}

GET /todos/:id

Get fancy-todo based id

Request Header

{
  "access_token": "<your access token>"
}

Request Params

{
    "id": "<id of todo>"
}

Request Body

not needed

Response (200)

  {
    "id": 1,
    "title": "<name to get insert into>",
    "description": "<description to get insert into>",
    "status": "<status to get insert into>",
    "due_date": "<due_date to get insert into>",
    "createdAt": "2020-03-20T07:15:12.149Z",
    "updatedAt": "2020-03-20T07:15:12.149Z",
  }

Response (500 - Server Error)

{
  "message": "Internal server error"
}

Response (404 - Not Found)

{
  "message": "Not Found"
}

PUT /todos/:id

Update todo

Request Header

{
  "access_token": "<your access token>"
}

Request Params

{
    "id": "<id of todo>"
}

Request Body

{
  "title": "<name to get insert into>",
  "description": "<description to get insert into>",
  "status": "<status to get insert into>",
  "due_date": "<due_date to get insert into>"
}

Response (200 - Updated)

{
  "id": <given id by system>,
  "title": "<name to get insert into>",
  "description": "<description to get insert into>",
  "status": "<status to get insert into>",
  "due_date": "<due_date to get insert into>",
  "createdAt": "2020-03-20T07:15:12.149Z",
  "updatedAt": "2020-03-20T07:15:12.149Z"
}

Response (400 - Bad Request)

{
  "message": "Invalid requests"
}

Response (404 - Not Found)

{
  "message": "Not Found"
}

Response (500 - Server Error)

{
  "message": "Internal server error"
}

DELETE /todos/:id

Get fancy-todo based id

Request Header

{
  "access_token": "<your access token>"
}

Request Params

{
    "id": "<id of todo>"
}

Request Body

not needed

Response (200)

  {
    "id": 1,
    "title": "<name to get insert into>",
    "description": "<description to get insert into>",
    "status": "<status to get insert into>",
    "due_date": "<due_date to get insert into>",
    "createdAt": "2020-03-20T07:15:12.149Z",
    "updatedAt": "2020-03-20T07:15:12.149Z",
  }

Response (404 - Not Found)

{
  "message": "Not Found"
}

Response (500 - Server Error)

{
  "message": "Internal server error"
}

POST /register

Create new user

Request Body

{
  "email": "<email to get insert into>",
  "password": "<password to get insert into>",  
}

Response (201 - Created)

{
  "id": <given id by system>,
  "email": "<email to get insert into>"
}

Response (400 - Bad Request)

{
  "message": "Invalid requests"
}

Response (500 - Server Error)

{
  "message": "Internal server error"
}

POST /login

Login user

Request Body

{
  "email": "<email to get insert into>",
  "password": "<password to get insert into>",  
}

Response (200 - OK)

{
  "access_token": "<your access token>"
}

Response (400 - Bad Request)

{
  "message": "Invalid requests"
}

Response (500 - Server Error)

{
  "message": "Internal server error"
}

User bisa create todo dan findAll Todo jika memberikan accesstoken. acces token tersebut sudah terverivikasi(Authentication)


User hanya bisa melihat (findOne), menghapus dan menghapus todonya sendiri (Authorization)

About

Membuat sebuah website untuk me-manage hal - hal menarik untuk dilakukan

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 76.8%
  • HTML 22.8%
  • Shell 0.4%