A simple todo web app for simplify your life.
Use NodeJs, and MongoDB.
By default, base url is at http://localhost:3000
Make a file called .env
and fill it with necessary environment such as:
- PORT
- MONGODB_URI
- JWT_SECRET
and put it on server folder
Authenticate | Authorized |
---|---|
No | No |
body request :
email type: String
requiredpassword type: String
required
response :
// success
{
"token": <token>,
"username": <username>
}
// error
{
"errors": [
"Email or password is wrong"
]
}
Authenticate | Authorized |
---|---|
No | No |
body request :
username type: String
requiredemail type: String
requiredpassword type: String mininum 6 character
required
response :
// success
{
"token": <token>,
"username": <username>
}
// error
{
"errors": [
"Email already registered"
]
}
Authenticate | Authorized |
---|---|
Yes | No |
headers request :
token type: String
required
response :
// success
[
{
"_id": <id>,
"name": <name>,
"description": <description>,
"dueDate": <due date>,
"owner": <owner id>,
"status": <status>,
"__v": 0
},
{
"_id": <id>,
"name": <name>,
"description": <description>,
"dueDate": <due date>,
"owner": <owner id>,
"status": <status>,
"__v": 0
}
]
// error
{
"errors": [
"Token is missing"
]
}
Authenticate | Authorized |
---|---|
Yes | No |
headers request :
token type: String
required
body request :
name type: String
requireddescription type: String
requireddueDate type: Date
required
response :
// success
{
"_id": <id>,
"name": <name>,
"description": <description>,
"dueDate": <due date>,
"owner": <owner id>,
"status": <status>,
"__v": 0
}
// error
{
"errors": [
"Cast to Date failed for value \"Invalid Date\" at path \"dueDate\"",
"Description is required"
]
}
Authenticate | Authorized |
---|---|
Yes | Yes |
headers request :
token type: String
required
params request :
todoId type: String
required
response :
// success
{
"_id": <id>,
"name": <name>,
"description": <description>,
"dueDate": <due date>,
"owner": <owner object>,
"status": <status>,
"__v": 0
}
// error
{
"errors": [
"You are not authorized"
]
}
Authenticate | Authorized |
---|---|
Yes | Yes |
headers request :
token type: String
required
params request :
todoId type: String
required
body request :
name type: String
description type: String
dueDate type: Date
status type: String
enum: 'done', 'pending', or 'overdue'
response :
// success
{
"_id": <id>,
"name": <name>,
"description": <description>,
"dueDate": <due date>,
"owner": <owner object>,
"status": <status>,
"__v": 0
}
// error
{
"errors": [
"Todo not found"
]
}
Authenticate | Authorized |
---|---|
Yes | Yes |
headers request :
token type: String
required
params request :
todoId type: String
required
response :
// success
{
"message": "Success delete todo"
}
// error
{
"errors": [
"Todo not found"
]
}