Giter Site home page Giter Site logo

todo-api's Introduction

TODO API Documentation

Overview

This TODO API allows you to manage your todo items. You can create, read, update, and delete todos. The API is built using AWS Lambda, API Gateway, and DynamoDB. It is designed to be deployed using the Serverless Framework.

Table of Contents

Getting Started

To get started with the TODO API, follow the instructions below to set up and deploy the application.

Prerequisites

  • Node.js (v14.x or later)
  • npm or yarn
  • AWS account
  • Serverless Framework

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/todo-api.git
    cd todo-api
  2. Install dependencies:

    npm install

Configuration

  1. Environment Variables: Create a .env file in the root directory and add the following environment variables:

    AWS_REGION=your-aws-region
    TODOS_TABLE=your-dynamodb-table-name
  2. Serverless Configuration: Update the serverless.yml file with your AWS region and DynamoDB table name.

Deploying the Application

To deploy the application to AWS, use the Serverless Framework:

serverless deploy

Running Tests

To run the tests for the TODO API, use the following command:

npm test

API Endpoints

Here are the available endpoints for the TODO API:

Create Todo

  • URL: /todos
  • Method: POST
  • Description: Create a new todo item.
  • Request Body:
    {
      "title": "Comprar leche",
      "metadata": {
        "prioridad": "alta"
      }
    }
  • Response:
    {
      "id": "1234",
      "title": "Comprar leche",
      "completed": false,
      "metadata": {
        "prioridad": "alta"
      }
    }

Get Todos

  • URL: /todos
  • Method: GET
  • Description: Retrieve a list of all todo items.
  • Response:
    [
      {
        "id": "1234",
        "title": "Comprar leche",
        "completed": false,
        "metadata": {
          "prioridad": "alta"
        }
      }
    ]

Update Todo

  • URL: /todos/{id}
  • Method: PUT
  • Description: Update an existing todo item.
  • Request Body:
    {
      "title": "Comprar leche y pan",
      "completed": true,
      "metadata": {
        "prioridad": "alta"
      }
    }
  • Response:
    {
      "id": "1234",
      "title": "Comprar leche y pan",
      "completed": true,
      "metadata": {
        "prioridad": "alta"
      }
    }

Delete Todo

  • URL: /todos/{id}
  • Method: DELETE
  • Description: Delete a completed todo item.
  • Response:
    {
      "message": "Todo deleted successfully"
    }

Delete Todo (Not Completed)

  • URL: /todos/{id}
  • Method: DELETE
  • Description: Return an error if the todo item is not completed.
  • Response:
    {
      "error": "Todo must be completed before deletion"
    }

This README provides a comprehensive guide to setting up, deploying, and using the TODO API. If you encounter any issues or have questions open an issue on the repository.

todo-api's People

Contributors

dopicatto avatar dpicattoqumind avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.