Skip to content

Latest commit

 

History

History
312 lines (262 loc) · 5.24 KB

doc.md

File metadata and controls

312 lines (262 loc) · 5.24 KB

Checklist App

Checklist App is an application to manage your daily tasks on your account. It performs standard CRUD actions based on RESTful concept.

This app has :

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

 

Tech Stack used to build this app :

  • Node JS
  • Express JS framework
  • PostgreSQL
  • Axios
  • Bycryptjs
  • Bootsrap
  • Cors
  • Google-Auth-Library
  • JSON Web Token
  • Sequelize

 

Global Responses

These responses are applied globally on all endpoints

Response (400 - Bad Request)

{
  "message": "Validation Error"
}

Response (401 - Unauthorized)

{
  "message": "No Authorization"
}

Response (404 - Not Found)

{ 
    "message":"Not Found"
}

Response (500 - Not Found)

{ 
    "message":"Internal Server Error"
}

 

RESTful endpoints

POST /user/login

Login into account

Request Body

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

Response (200)

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

POST /user/register

Register new account

Request Body

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

Response (200)

{
    "id": 1,
    "email": "[email protected]",
    "createdAt": "<Created date given by system>",
    "updatedAt": "<Updated date given by system>"
}

GET /todos

Create new asset

Request Header

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

Response (200 - OK)

[
    {
        "id": <given id by system>,
        "title": "<posted title>",
        "description": "<posted description>",
        "status":"<posted status>",
        "due_date":"<posted due_date>,
        "createdAt": "<Created date given by system>",
        "updatedAt": "<Updated date given by system>" 
        "UserId" : "<User id FK referred to user ID>"
    }, 
    {
        "id": <given id by system>,
        "title": "<posted title>",
        "description": "<posted description>",
        "status":"<posted status>",
        "due_date":"<posted due_date>,
        "createdAt": "<Created date given by system>",
        "updatedAt": "<Updated date given by system>" 
        "UserId" : "<User id FK referred to user ID>"
    }
]

POST /todos

Create new todo

Request Header

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

Request Body

{
  "title": "title",
  "description": "description",
  "status":"true or false",
  "due_date":"due date",
}

Response (201 - Created)

{
  "id": <given id by system>,
  "title": "<posted title>",
  "description": "<posted description>",
  "status":"<posted status>",
  "due_date":"<posted due_date>,
  "createdAt": "<Created date given by system>",
  "updatedAt": "<Updated date given by system>" 
  "UserId" : "<User id FK referred to user ID>"
}

GET /todos/:id

Show single task defined by the id provided

Request Header

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

Response (200 - OK)

{
  "id": <given id by system>,
  "title": "<posted title>",
  "description": "<posted description>",
  "status":"<posted status>",
  "due_date":"<posted due_date>,
  "createdAt": "<Created date given by system>",
  "updatedAt": "<Updated date given by system>" 
  "UserId" : "<User id FK referred to user ID>"
}

PUT /todos/:id

Update a task defined by the id provided

Request Header

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

Request Body

{
    "title": "new Title",
    "description": "new Description",
    "status":"new Status",
    "due_date":"new Due date"
}

Response (200 - OK)

{
  "id": <given id by system>,
  "title": "<edited title>",
  "description": "<edited description>",
  "status":"<edited status>",
  "due_date":"<edited due_date>,
  "createdAt": "<Created date given by system>",
  "updatedAt": "<Updated date given by system>" 
  "UserId" : "<User id FK referred to user ID>"
}

PATCH /todos/:id

Update task's status defined by the id provided

Request Header

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

Request Body

{
    "status": "new Status"
}

Response (200 - OK)

{
  "id": <given id by system>,
  "title": "<edited title>",
  "description": "<edited description>",
  "status":"<edited status>",
  "due_date":"<edited due_date>,
  "createdAt": "<Created date given by system>",
  "updatedAt": "<Updated date given by system>" 
  "UserId" : "<User id FK referred to user ID>"
}

DELETE /todos/:id

Delete task's status defined by the id provided

Request Header

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

Response (200 - OK)

{
  "message" : "todo succes to delete"
}

GET /weather

Show weather

Request Header

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

Response (200 - OK)

[
    {
        "location": "Jakarta",
        "time": "<current time>",
        "temperature": "<current temp>",
        "icons": ["icon url"],
        "descriptions": ["weather descriptions"]
    }
]