Skip to content

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

Notifications You must be signed in to change notification settings

rachimawan/fancy-todo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fancy-Todo

Fancy Todo App Server Fancy Todo App is an application to manage your assets. This app has :

 

Endpoints

- POST /register
- POST /login
- POST /todos
- GET /todos
- GET /todos/:id
- PUT /todos/:id
- DELETE /todos/:id

RESTful endpoints

POST /register

Create new user to database

Request Header

not needed

Request Body

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

Response (201 - Created)

{
  "id": "<given_id_by__system>",
  "email": "<posted email>",
  "password": "<posted password>",
  "createdAt": "2020-03-20T07:15:12.149Z",
  "updatedAt": "2020-03-20T07:15:12.149Z",
}

Response (400 - Bad Request)

{
  "message": "Please input email format!, Password minimum 4 characters!"
}

Response (500 - Internal Error Server)

{
  "message": "Internal Server Error"
}

POST /login

Login to todos

Request Header

not needed

Request Body

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

Response (200)

{
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwidXNlcm5hbWUiOiJmYXVkemFuIiwiaWF0IjoxNTk4OTU1OTk2fQ.-bZ3Gi4AXPQMtrHfbxJ605On57u4gRXfU0ok88aIW94"
}

Response (400 - Bad Request)

{
  "message": "Invalid email or password"
}

Response (500 - Internal server error)

{
  "message": "Internal Server Error"
}

GET /todos

Get all todos

Request Header

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

Request Body

not needed

Response (200)

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

Response (401 - Not Authenticated)

{
  "message": "Doesnt recognize User!"
}

Response (500 - Internal server error)

{
  "message": "Internal Server Error"
}

POST /todos

Create new todos

Request Header

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

Request Body

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

Response (201 - Created)

{
  "id": "<given id by system>",
  "title": "<posted title>",
  "description": "<posted description>",
  "due_date": "<posted due_date>",
  "createdAt": "2020-03-20T07:15:12.149Z",
  "updatedAt": "2020-03-20T07:15:12.149Z",
}

Response (401 - Not Authenticated)

{
  "message": "Doesnt recognize User!"
}

Response (400 - Bad Request)

{
  "message": "Invalid date input, Input your todo title please!, Please input your todo description"
}

GET /todos/:id

Find detail todo by ID

Request Header

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

Request Body

not needed

Response(200)

[
  {
    "id": 1,
    "title": "<todos name>",
    "description": "<todos description>",
    "due_date": "<todos due_date>"
    "createdAt": "2020-03-20T07:15:12.149Z",
    "updatedAt": "2020-03-20T07:15:12.149Z",
  },
]

Response (401 - Not Authenticated)

{
  "message": "Doesnt recognize User!"
}

Response (404 - Not Found)

{
  "message": "Not Found"
}

PUT /todos/:id

Update todo by ID

Request Header

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

Request Body

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

Response (200)

{
  "id": "<selected id>",
  "title": "<updated title>",
  "description": "<updated description>",
  "due_date": "<updated due_date>",
  "createdAt": "2020-03-20T07:15:12.149Z",
  "updatedAt": "2020-03-20T07:15:12.149Z",
}

Error response: Response (400 - Bad request)

{
  "message": "Invalid date input, Input your todo title please!, Please input your todo description"
}

Response (404 - Not Found)

{
  "message": "Not Found"
}

Response (500 - Internal Server Error)

{
  "message": "Internal Server Error"
}

DELETE /todos/:id

Delete todo data by ID

Request Header

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

Request Body

not needed

Response(200)

[
  {
    "id": "<selected id>",
    "title": "<todos name>",
    "description": "<todos description>",
    "due_date": "<todos due_date>",
    "createdAt": "2020-03-20T07:15:12.149Z",
    "updatedAt": "2020-03-20T07:15:12.149Z",
  },
]

Error response: Response (404 - Not Found)

{
  "message": "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 78.8%
  • HTML 16.1%
  • CSS 5.1%