Skip to content

thomasaugot/todayzzz-todo-app-backend

Repository files navigation

TODAYZZZ TODOS - Backend PERN stack - hosted on Fly.io

This is the backend of my todo list app I named TODAYZZZ TODOS, providing a RESTful API for managing users, collections, and todo items.
For the frontend code, please go to https://github.com/thomasaugot/todayzzz-todo-app-frontend

Prerequisites

Before you begin and run the app locally, ensure you have met the following requirements:

  • Node.js: You should have Node.js installed on your system. If not, you can download and install it from nodejs.org.

Installation

  1. Clone this repository to your local machine:

    git clone https://github.com/thomasaugot/ts-todo-app-backend
  2. Go to the project directory:

    cd ts-todo-app-backend
  3. Install project dependencies:

    npm install
  4. Configure environment variables:

Create a .env file in the project root directory and define the necessary environment variables, such as database connection details, as needed. You can use the .env.example file as a template.

DATABASE_URL=your_database_url
PORT=3001
  1. Start the server:

    npm start

The server should now be running and listening on the specified port.

Usage

API Endpoints

  1. Create a User (Sign Up)
    Endpoint: POST /api/users
    Request Body: JSON with user information
    Response: New user information

  2. Get User by ID
    Endpoint: GET /api/users/:user_id
    Response: User information by ID

  3. Update User by ID
    Endpoint: PUT /api/users/:user_id
    Request Body: JSON with updated user information
    Response: Updated user information

  4. Delete User by ID
    Endpoint: DELETE /api/users/:user_id
    Response: No content

  5. Create a Collection
    Endpoint: POST /api/collections
    Request Body: JSON with collection information
    Response: New collection information

  6. Get All Collections
    Endpoint: GET /api/collections
    Response: List of collections

  7. Get Collection by ID
    Endpoint: GET /api/collections/:collection_id
    Response: Collection information by ID

  8. Update a Collection by ID
    Endpoint: PUT /api/collections/:collection_id
    Request Body: JSON with updated collection information
    Response: Updated collection information

  9. Delete a Collection by ID
    Endpoint: DELETE /api/collections/:collection_id
    Response: No content

  10. Create a Todo Item
    Endpoint: POST /api/todo_items
    Request Body: JSON with todo item information
    Response: New todo item information

  11. Get Todo Item by ID
    Endpoint: GET /api/todo_items/:todo_item_id
    Response: Todo item information by ID

  12. Update Todo Item by ID
    Endpoint: PUT /api/todo_items/:todo_item_id
    Request Body: JSON with updated todo item information
    Response: Updated todo item information

  13. Delete Todo Item by ID
    Endpoint: DELETE /api/todo_items/:todo_item_id
    Response: No content

Tech stack

This project was built using React, Typescript, Express, Node.js, PostgrSQL, Jest and SCSS.

Demo

Access the live website at https://todayzzz-todos.netlify.app/