Introduction

API to create, obtain and complete a to-do list, the API was created in NodeJS, you can find the repository in the following link:


It has been deployed in a AWS container and Route 53 was used to link it with my domain.

GET Get to-do list

                            js01.gmendozas.com/todos?showPending={value}
                        

Get the whole list.

Response example
                                    
{
    "todos": [
        {
            "id": 1,
            "name": "Learn JS",
            "complete": false
        },
        {
            "id": 2,
            "name": "Walk the dog",
            "complete": false
        },
        {
            "id": 3,
            "name": "Go shopping",
            "complete": true
        },
        {
            "id": 4,
            "complete": true,
            "name": "Feed the cat"
        },
        {
            "id": 5,
            "complete": false,
            "name": "Pick up laundry"
        }
    ]
}
                                    
                                

PARAMS

Name
Type
Description
showPending
Number
0 for returning all items, 1 for returning only completed items.
Example Request
                                curl --location --request GET 'js01.gmendozas.com/todos?showPending=0'
                            

POST Create an item

                            js01.gmendozas.com/todos
                        

Create an item for a to-do list. It returns and object with the status of the operation and the id of the new item.

Response example
                                    
    {
    "status": "ok",
    "id": 5
    }
                                    
                                

BODY
                                    
        {
            "name": "{Name_of_new_item}"
        }
                                    
                                

Example Request
                                curl --location --request POST 'js01.gmendozas.com/todos' \
            --data-raw '{ 
                "name": "Pick up laundry" 
            }'
                                
                            

PUT Complete an item

                            js01.gmendozas.com/todos/{id}/complete
                        

Complete an item from the list. It returns an object with the status of the operation.

Response example
                                    
    {
    "status": "ok"
    }
                                    
                                

Example Request
                                curl --location --request PUT 'js01.gmendozas.com/todos/4/complete'
                            
Understood
This website is using cookies. More details