Skip to content

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

Notifications You must be signed in to change notification settings

adiet95/fancy-todo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FANCY TO DO Server

Fancy To Do is an application to manage your activity. This app has :

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

 

RESTful endpoints

POST /register

Create new user

Request Header

not needed

Request Body

{
  "name": "Adiet Alimudin",
  "email": "test123@gmail.com",
  "password": "1234567"
}

Success Response:

Response (201 - Created)

{
  "id": 6,
  "name": "Adiet Alimudin",
  "email": "test123@gmail.com",
  "password": "$2b$10$xfLIEC1yVj5TYtQ3PZw/c.0D97Ij5NOPC4BMOBdA9JSbPC3MAhvue",
  "updatedAt": "2020-09-06T15:41:15.278Z",
  "createdAt": "2020-09-06T15:41:15.278Z"
}

Error Response:

Response (400 - Bad Request)

[
  "please enter correct email"
]

Response (409 - conflict)

{
  "message": "Email Already registered!"
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

POST /login

Process Login

Request Header

not needed

Request Body

{
  "email": "test123@gmail.com",
  "password": "1234567"
}

Success Response:

Response (200 - Ok)

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjYsIm5hbWUiOiJNYWxpayIsImVtYWlsIjoibWFsaWtAbWFpbC5jb20iLCJpYXQiOjE1ODYxOTEzNjksImV4cCI6MTU4NjE5NDk2OX0.WNLicaqoVUNPgvqq_5y4bzXy9oflshME6ARWHk1z1Po"
}

Error Response:

Response (400 - Bad Request)

[
  "message": "Wrong Password!"
]

Response (404 - Not Found)

{
  "message": "user not registered!"
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

POST /todos

Create new todo

Request Header

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjYsIm5hbWUiOiJNYWxpayIsImVtYWlsIjoibWFsaWtAbWFpbC5jb20iLCJpYXQiOjE1ODYxOTEzNjksImV4cCI6MTU4NjE5NDk2OX0.WNLicaqoVUNPgvqq_5y4bzXy9oflshME6ARWHk1z1Po"
}

Request Body

{
  "title": "belajar nodejs"
  "description": "belajar nodejs"
  "status": "incomplete"
  "due_date": "2020-10-01"
}

Success Response:

Response (201 - Created)

{
  "id": 13,
  "title": "belajar nodejs",
  "description": "belajar nodejs",
  "status": "Incomplete",
  "due_date": "2020-10-01T00:00:00.000Z",
  "UserId": 6,
  "updatedAt": "2020-09-06T16:53:36.080Z",
  "createdAt": "2020-09-06T16:53:36.080Z"
}

Error Response:

Response (400 - Bad Request)

[
  "description can't be empty"
]

Response (401 - Unauthorized)

{
  "message": "Not authenticated!"
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

GET /todos

Get User's todos

Request Header

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjYsIm5hbWUiOiJNYWxpayIsImVtYWlsIjoibWFsaWtAbWFpbC5jb20iLCJpYXQiOjE1ODYxOTEzNjksImV4cCI6MTU4NjE5NDk2OX0.WNLicaqoVUNPgvqq_5y4bzXy9oflshME6ARWHk1z1Po"
}

Request Body

not needed

Success Response:

Response (200 - Ok)

[
  {
  "id": 14,
  "title": "belajar nodejs",
  "description": "belajar nodejs Ampe mahir",
  "status": "Complete",
  "due_date": "2020-10-01T00:00:00.000Z",
  "UserId": 6,
  "createdAt": "2020-09-06T17:00:37.435Z",
  "updatedAt": "2020-09-06T17:04:42.252Z"
  },
  {
  "id": 13,
  "title": "belajar nodejs",
  "description": "belajar nodejs Ampe mahir",
  "status": "Complete",
  "due_date": "2020-10-01T00:00:00.000Z",
  "UserId": 6,
  "createdAt": "2020-09-06T16:53:36.080Z",
  "updatedAt": "2020-09-06T17:05:51.056Z"
  }
]

Error Response:

Response (401 - Unauthorized)

{
  "message": "Not authenticated!"
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

GET /todos/:id

Get todo by todo's id

Request Header

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjYsIm5hbWUiOiJNYWxpayIsImVtYWlsIjoibWFsaWtAbWFpbC5jb20iLCJpYXQiOjE1ODYxOTEzNjksImV4cCI6MTU4NjE5NDk2OX0.WNLicaqoVUNPgvqq_5y4bzXy9oflshME6ARWHk1z1Po"
}

Request Body

not needed

Success Response:

Response (200 - Ok)

{
  "id": 13,
  "title": "belajar nodejs",
  "description": "belajar nodejs Ampe mahir",
  "status": "Complete",
  "due_date": "2020-10-01T00:00:00.000Z",
  "UserId": 6,
  "createdAt": "2020-09-06T17:00:37.435Z",
  "updatedAt": "2020-09-06T17:04:42.252Z"
}

Error Response:

Response (401 - Unauthorized)

{
  "message": "Not authenticated!"
}

Response (403 - Forbidden)

{
  "message": "Forbidden access!"
}

Response (404 - Not Found)

{
  "message": "Todo not found! "
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

PUT /todos/:id

Update todo

Request Header

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjYsIm5hbWUiOiJNYWxpayIsImVtYWlsIjoibWFsaWtAbWFpbC5jb20iLCJpYXQiOjE1ODYxOTEzNjksImV4cCI6MTU4NjE5NDk2OX0.WNLicaqoVUNPgvqq_5y4bzXy9oflshME6ARWHk1z1Po"
}

Request Body

{
  "title": "belajar nodejs"
  "description": "belajar nodejs Ampe mahir"
  "status": "Complete"
  "due_date": "2020-10-01"
}

Success Response:

Response (201 - Created)

{
  "id": 13,
  "title": "belajar nodejs",
  "description": "belajar nodejs Ampe mahir",
  "status": "Complete",
  "due_date": "2020-10-01T00:00:00.000Z",
  "UserId": 6,
  "createdAt": "2020-09-06T17:00:37.435Z",
  "updatedAt": "2020-09-06T17:04:42.252Z"
}

Error Response:

Response (401 - Unauthorized)

{
  "message": "Not authenticated!"
}

Response (403 - Forbidden)

{
  "message": "Forbidden access!"
}

Response (404 - Not Found)

{
  "message": "Todo not found! "
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

DELETE /todos/:id

Update todo

Request Header

{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySWQiOjYsIm5hbWUiOiJNYWxpayIsImVtYWlsIjoibWFsaWtAbWFpbC5jb20iLCJpYXQiOjE1ODYxOTEzNjksImV4cCI6MTU4NjE5NDk2OX0.WNLicaqoVUNPgvqq_5y4bzXy9oflshME6ARWHk1z1Po"
}

Request Body

not needed

Success Response:

Response (200 - Ok)

{
  "id": 15,
  "title": "belajar nodejs",
  "description": "belajar nodejs Ampe mahir",
  "status": "Complete",
  "due_date": "2020-10-01T00:00:00.000Z",
  "UserId": 6,
  "createdAt": "2020-09-06T17:04:12.393Z",
  "updatedAt": "2020-09-06T17:04:12.393Z"
}

Error Response:

Response (401 - Unauthorized)

{
  "message": "Not authenticated!"
}

Response (403 - Forbidden)

{
  "message": "Forbidden access!"
}

Response (404 - Not Found)

{
  "message": "Todo not found! "
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

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 75.4%
  • HTML 21.2%
  • CSS 3.0%
  • Shell 0.4%