---
title: "API &#8211; Task API"
canonical_url: "https://cplatt.xyz/portfolio/api-task-api/"
published: "2024-09-28T22:40:27+00:00"
modified: "2024-09-28T22:40:27+00:00"
author: "cplatt_owner"
markdown_profile: "standard"
---

Github - [https://github.com/plattnotpratt/task-api](https://github.com/plattnotpratt/task-api)

Demo - [https://task-api.cplatt.xyz/](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](#features)
- [Tech Stack](#tech-stack)
- [Getting Started](#getting-started)
- [API Endpoints](#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.

---

Source: [API &#8211; Task API](https://cplatt.xyz/portfolio/api-task-api/)
