This is a RESTful API for managing projects, tasks, and users. It is built using Node.js, Express, and Prisma ORM with a PostgreSQL database.
-
Clone the repository:
git clone https://github.com/your-username/project-management-api.git cd project-management-api -
Install dependencies:
npm install
-
Install Prisma CLI (if not already installed):
npm install -g prisma
-
Create a
.envfile in the root directory and add the following environment variables:DATABASE_URL=postgresql://user:password@localhost:5432/mydatabase JWT_SECRET=your_jwt_secret PORT=5000Replace
user,password,localhost,5432, andmydatabasewith your PostgreSQL credentials and database name. -
Set up the database:
Run the following command to apply the Prisma schema to your database:
npx prisma migrate dev --name init
-
Start the development server:
npm run dev
The server will start on the port specified in your
.envfile (default is 5000).
-
User Endpoints:
POST /users: Create a new userPOST /users/getToken: Authenticate user and get a tokenGET /users: Get all usersPUT /users/:id: Update a userDELETE /users/:id: Delete a user
-
Project Endpoints:
POST /projects: Create a new projectGET /projects: Get all projectsPUT /projects/:id: Update a projectDELETE /projects/:id: Delete a project
-
Task Endpoints:
POST /projects/:projectId/tasks: Create a new task under a projectGET /projects/:projectId/tasks: Get all tasks for a specific projectPUT /tasks/:taskId: Update a taskDELETE /tasks/:taskId: Delete a task
-
Filter Endpoints:
GET /tasks: Filter tasks by status and assigned user
To test the API endpoints, you can use Postman or any other API testing tool. Ensure your server is running and use the endpoints listed above to interact with the API.