Categorygithub.com/withoutsecondd/ToDo
modulepackage
0.0.0-20240826182839-ab930a632e77
Repository: https://github.com/withoutsecondd/todo.git
Documentation: pkg.go.dev

# README

ToDo

A simple REST API pet project written in Go, application performs basic API operations with users/lists/tasks etc., includes basic JWT token-based authentication

Currently, API is built for a user-specific use, meaning that all endpoints returns information based on the authorization (JWT) token bearer. Viewing other users' profile information, lists and tasks is not implied by this application, so there are no endpoints to do so.

API endpoints:


Users

  • GET /api/users/
    Returns the token bearer's information

  • POST /api/users/
    Creates a new user

Lists

  • GET /api/lists/
    Returns the token bearer's lists

  • GET /api/lists/{id}
    Returns a list specified by id. If a list doesn't belong to token bearer request will fail

  • POST /api/lists/
    Creates a new list

Tasks

  • GET /api/tasks/
    Parameters:
    • Optional list_id

    Returns tasks specified by the list_id parameter, if no list_id parameter is provided, this endpoint will return all the token bearer's tasks. If list specified by list_id doesn't belong to the token bearer request will fail

  • GET /api/tasks/{id}
    Returns a task specified by id. If a task doesn't belong to token bearer request will fail

  • POST /api/tasks/
    Creates a new task

Tags

  • GET /api/tags/
    Parameters:
    • Optional task_id

    Returns tags specified by the task_id parameter, if no task_id parameter is provided, this endpoint will return all the token bearer's tags. If task specified by task_id doesn't belong to the token bearer request will fail

  • GET /api/tags/{id}
    Returns a tag specified by id. If a tag doesn't belong to token bearer request will fail

  • POST /api/tags/
    Creates a new tag

Other

  • POST /api/login/
    Used for authentication. A JWT token is returned if credentials are correct

  • PATCH /api/emails/verify/
    Parameters:
    • Optional t

    Used for email verification. This endpoint will email current user if no t (token) parameter is provided. When user sends another request with t parameter provided, application validates the token and changes the user's email status to "verified" if token is valid

Used Frameworks/Packages:

  • Go Fiber
  • jmoiron/sqlx to perform SQL queries (used database is MySQL)
  • x/crypto/bcrypt for encryption and hashing passwords
  • golang-jwt/jwt/v5 for operations with JWT
  • validator/v10 for validating structs fields
  • zhashkevych/go-sqlxmock for mocking sql driver behavior
  • gopkg.in/gomail.v2 for sending emails

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author