Code Monkey home page Code Monkey logo

todo-app's Introduction

To-Do Application

This is a To-Do application built using Golang, HTML, CSS, and JavaScript. The backend is powered by the Fiber framework and a PostgreSQL database.

Features

  • User authentication (sign-up and log-in)
  • Task creation, updating, deletion
  • Task status updates
  • Task filtering by status
  • Retrieve details of individual tasks

System Design Diagram

System Design

API Endpoints

User Authentication

Sign-up

  • Endpoint: POST /signup
  • Description: Register a new user.
  • Request Body:
    {
        "username": "string",
        "password": "string"
    }
  • Response:
    {
        "message": "User created successfully."
    }

Log-in

  • Endpoint: POST /login
  • Description: Authenticate a user and return a token.
  • Request Body:
    {
        "username": "string",
        "password": "string"
    }
  • Response:
    {
        "token": "jwt_token"
    }

User Management

Get User Details

  • Endpoint: GET /users/{userId}
  • Description: Retrieve user details by user ID.
  • Request Headers:
    Authorization: Bearer jwt_token
    
  • Response:
    {
        "userId": "integer",
        "username": "string"
    }

Task Management

Create Task

  • Endpoint: POST /tasks
  • Description: Create a new task.
  • Request Headers:
    Authorization: Bearer jwt_token
    
  • Request Body:
    {
        "title": "string",
        "description": "string",
        "status": "string"  // e.g., "pending", "completed"
    }
  • Response:
    {
        "taskId": "integer",
        "message": "Task created successfully."
    }

Update Task

  • Endpoint: PUT /tasks/{taskId}
  • Description: Update an existing task.
  • Request Headers:
    Authorization: Bearer jwt_token
    
  • Request Body:
    {
        "title": "string",
        "description": "string",
        "status": "string"  // e.g., "pending", "completed"
    }
  • Response:
    {
        "message": "Task updated successfully."
    }

Delete Task

  • Endpoint: DELETE /tasks/{taskId}
  • Description: Delete a task by task ID.
  • Request Headers:
    Authorization: Bearer jwt_token
    
  • Response:
    {
        "message": "Task deleted successfully."
    }

Get Task List

  • Endpoint: GET /tasks
  • Description: Retrieve a list of tasks with optional filters.
  • Request Headers:
    Authorization: Bearer jwt_token
    
  • Request Parameters:
    • status (optional): Filter tasks by status (e.g., pending, completed).
  • Response:
    {
        "tasks": [
            {
                "taskId": "integer",
                "title": "string",
                "description": "string",
                "status": "string",
                "createdAt": "datetime",
                "updatedAt": "datetime"
            },
            ...
        ]
    }

Get Task Details

  • Endpoint: GET /tasks/{taskId}
  • Description: Retrieve details of a specific task by task ID.
  • Request Headers:
    Authorization: Bearer jwt_token
    
  • Response:
    {
        "taskId": "integer",
        "title": "string",
        "description": "string",
        "status": "string",
        "createdAt": "datetime",
        "updatedAt": "datetime"
    }

Getting Started

Prerequisites

  • Go 1.16 or later
  • PostgreSQL
  • Fiber framework
  • HTML, CSS, JavaScript

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/todo-app.git
    cd todo-app
  2. Install dependencies:

    go get -u github.com/gofiber/fiber/v2
    go get -u github.com/gofiber/template/html/v2
    go get -u github.com/lib/pq
  3. Set up the PostgreSQL database and update the connection string in the code:

    postgresql://<username>:<password>@<address>/<database_name>?sslmode=disable
  4. Run the application:

    go run server.go

Usage

Access the application at http://localhost:3000.

todo-app's People

Contributors

letsmakecakes 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.