A simple task management backend API built with Node.js, Express, Sequelize, and PostgreSQL.
- Create, read, update, and delete tasks
- Tasks have a title, description, due date, and status (pending, in_progress, completed)
- Validation for task data input
- Automated backend tests with Jest and Supertest
- Node.js v14 or newer
- PostgreSQL database
- Clone the repository:
git clone https://github.com/JemScripts/hmcts-task-manager.git- Install dependencies:
npm install- Create a
.envfile in the root directory and add your database configuration:
DB_HOST=localhost
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_NAME=taskdb
DB_PORT=5432
PORT=8080
- Make sure your PostgreSQL database is running and the database specified in
DB_NAMEexists.
Under the client folder, run the command:
npm run devThis will start the server on http://localhost:5173/
Under the server folder, run the command:
node server.jsThe server will start on the port defined in .env (default 8080).
POST /api/tasks— Create a new taskGET /api/tasks— Retrieve all tasksGET /api/tasks/:id— Retrieve a task by IDPUT /api/tasks/:id— Update a task by IDPATCH /api/tasks/:id/status— Update task status onlyDELETE /api/tasks/:id— Delete a task by IDDELETE /api/tasks— Delete all tasks
title: required for creating tasksstatus: must be one ofpending,in_progress, orcompleteddueDate: must be a valid ISO date string if provided
This project includes automated backend tests for the Task API using Jest and Supertest. These tests cover:
- Creating tasks
- Fetching tasks (all and by ID)
- Updating tasks (including status updates)
- Deleting tasks
To run the backend tests, use the following command:
npm run testThe tests will reset the database state before running to ensure a clean environment.