• Skip to main content

CPlatt Portfolio

Creating a Visually Stunning Web

  • Portfolio
  • Blog

API – Task API

September 28, 2024 by Chris Platt

Github – https://github.com/plattnotpratt/task-api

Demo – https://task-api.cplatt.xyz/

A simple and easy-to-use REST API for managing a Task List API. This API allows users to perform CRUD operations (Create, Read, Update, Delete) on tasks.

Table of Contents

  • Features
  • Tech Stack
  • Getting Started
  • API Endpoints

Features

  • Create Tasks: Add new tasks to the ToDo list.
  • View Tasks: Retrieve a list of tasks or a specific task by ID.
  • Update Tasks: Modify existing tasks (e.g., mark them as completed).
  • Delete Tasks: Remove tasks from the list.

Tech Stack

  • Backend: Node.js (Express)
  • Database: MySQL
  • Authentication: JWT (JSON Web Tokens)

Endpoints

All endpoints except those under the AUTH(POST) check to make sure that the task is associated with the logged in user. If the user isn’t logged in then the API will respond with an error: This user does not have a task with this id: (Num), or This user is not authorized to make changes to this task

AUTH(POST):
  • task-api.cplatt.xyz/auth/signup – Post valid data requirements in the body of the request, and you should receive back a token for future requests.
    • Requirements
      • fname : string
      • lname : string
      • email : string (Valid email)
      • password : string (Valid password)
  • task-api.cplatt.xyz/auth/login – Checks the database for a user associated with the email and then checks the password matches the hashed pass on the database.
    • Requirements
      • email : string (Valid email)
      • password : string (Valid password)
GET:
  • task-api.cplatt.xyz/task/ – Get all tasks from the database associated with the user.
  • task-api.cplatt.xyz/task/:id – Get a single task denoted by the id from the database associated with the user.
POST:
  • task-api.cplatt.xyz/task/ – Create a Task and store it to the database associated with the user.
PUT:
  • task-api.cplatt.xyz/task/:id – Update a task denoted by the id from the database associated with the user.
  • task-api.cplatt.xyz/task/toggle/:id – Toggle the complete boolean in the task row denoted by the id from the database associated with the user
DELETE:
  • task-api.cplatt.xyz/task/:id – Delete a task from the database denoted by the id and associated with the user.

CPlattDesign © 2012–2025