A full-stack web application that allows users to create new tasks. The page displays the current task list.
Front-end: JavaScript, HTML, CSS, React (vite), Axios.
Back-end: JavaScript, Express, Supertest, PostgreSQL, node-postgres.
- Ensure port 9090 (for the back-end) is not in use.
- Clone the repository
git clone https://github.com/AB45699/hmcts.git - Navigate to the back-end (server) folder and install the dependencies:
cd hmcts/servernpm install - Create the following environment file within
hmcts/server:
Inside.envputPGDATABASE=hmcts_cases_test - To create the database, run the command:
npm run create-db - To seed the databse, run the command:
npm run seed - To run the back-end server, run the command:
npm run dev
This will start the server on the specified port (localhost:9090) - Open a new terminal window and navigate to the front-end folder and install the dependencies:
cd hmcts/front-end/hmcts-frontendnpm install - To start the front-end server, run the command:
npm run dev
- To run the unit tests for the endpoints/server, navigate to:
cd hmcts/serverand run the command:npm test - To run the unit tests for the backend utility functions, in the same folder, run:
npm run test-utils
The server has two endpoints:
- GET
/api/cases
- This will return all tasks in the database in descending order of case_id (so in order of the latest inserted tasks).
- POST
/api/cases
- This allows posting of a new task.
- Example of a payload received:
{
case_number: "Case 3",
case_title: "Case 3 title",
case_description: "Case 3 description",
case_status: "Completed",
due: "2025-03-20 17:45:00"
}