git clone https://github.com/travisfisher/todo-api
cd todo-api
npm install
Start API with JWT Authentication:
npm run start-auth
Start API without JWT Authentication:
npm run start
Either of these commands will start the API service on http://localhost:3000
Below are the set of methods that are available to you.
Note that all POST methods are expected to be submitted as: Content-Type: application/x-www-form-urlencoded
Request body:
Parameter Key | Type |
---|---|
username | string |
password | string |
Response body:
{
"accessToken": "...",
"user": {
"id": 1,
"username": "[email protected]",
"password": "abc123",
"first_name": "John",
"last_name": "Smith"
}
}
Response body:
[
{
"id": 1,
"user_id": 1,
"task": "Task 1",
"complete": 0
},
{
"id": 2,
"user_id": 1,
"task": "Task 2",
"complete": 0
},
{
"id": 3,
"user_id": 1,
"task": "Task 3",
"complete": 0
}
]
Response body:
{
"id": 1,
"user_id": 1,
"task": "Task 1",
"complete": 0
}
Request body:
Parameter Key | Type | Required |
---|---|---|
user_id | Integer | Yes |
task | String | Yes |
complete | 0 or 1 | Yes |
Response body:
{
"id": 3,
"user_id": 1,
"task": "Task 3",
"complete": 0
}
Request body:
Parameter Key | Type | Required |
---|---|---|
user_id | Integer | No |
task | String | No |
complete | 0 or 1 | No |
Response body:
{
"id": 3,
"user_id": 1,
"task": "Task 3",
"complete": 1
}
Feel free to submit pull requests, create issues or spread the word.