Fancy Todo App Server Fancy Todo App is an application to manage your assets. This app has :
- POST /register
- POST /login
- POST /todos
- GET /todos
- GET /todos/:id
- PUT /todos/:id
- DELETE /todos/:id
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"
}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 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"
}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"
}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"
}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 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"
}