Frontend repository can be found here.
PSQL was used to create the database.
- The configuration can be found here.
- The SQL dump file can be found here. Please copy this to your PSQL bin folder.
- Run SQL shell (psql) and create the database
tasks
. (If you would like to rename it something else, make sure to change the database specified in thedb.js
config.) - Run cmd on adminstrator.
cd
to your PSQL bin folder. The file path should look something like this:C:\Program Files\PostgreSQL\14\bin
.- Restore the dump file in the database you created in step 1 by running the following command in cmd:
psql DATABASE_NAME_HERE < todo.sql
Optional: Use the flag -U postgres
if you are having issues with password authentication.
If you encounter trouble using the dump file, here are the manual commands to run in SQL shell (psql):
CREATE TABLE tasks (
id SERIAL PRIMARY KEY,
description VARCHAR (100) UNIQUE NOT NULL
);
CREATE TYPE status AS ENUM ('in-progress', 'completed');
ALTER TABLE tasks
ADD COLUMN status status;
CREATE TYPE priority AS ENUM ('low', 'medium', 'high');
ALTER TABLE tasks
ADD COLUMN priority priority;
Make sure you have the latest version of Express and Node installed.
npm install
After connecting to the PSQL server, use npm run dev
to run the API.
- User is able to make a GET request for a task specified by its ID, using
getTaskById
. - Endpoint:
/tasks/:id
- User is able to make a GET request for all tasks found in the database, using
getTasks
. - Endpoint:
/tasks
- User is able to make a GET request for filtered tasks by completion status (i.e., in-progress or completed) using
getTasksByStatus
, or by priority level (i.e., low, medium, or high) usinggetTasksByPriority
. - Endpoint:
/tasks/status/:status
- Endpoint:
/tasks/priority/:priority
- User is able to make a POST request for a task using
addTask
. - Endpoint:
/tasks
- User is able to make a PUT request for a task specified by its ID, using
updateDescription
,updateStatus
, and/orupdatePriority
. - Endpoint:
/update/description/:id
- Endpoint:
/update/priority/:id
- Endpoint:
/update/status/:id
- User is able to make a DELETE request for a task specified by its ID, using
deleteTask
. - Endpoint:
/tasks/:id