This is the Backend for the Project Management System built using Node.js and Express.js. The backend serves as the API layer for the frontend application, providing endpoints for managing projects, tasks, and users. It also handles authentication, authorization, and data storage.
- RESTful API: Provides endpoints for managing projects, tasks, and users.
- Authentication & Authorization: Secure user authentication and role-based access control.
- Database Integration: Connects to a database for persistent storage of projects, tasks, and user data.
- Error Handling & Logging: Centralized error handling and logging for easy debugging and monitoring.
To get started with the backend project locally, follow these steps:
- Clone the repository:
git clone https://github.com/gayali/project-backend.git
- Navigate to the project directory:
cd project-backend - Install dependencies:
composer install
Before running the backend server, you need to configure your environment variables. Follow these steps:
-
Copy the
.env.examplefile:In the root directory of the project, you’ll find a file named
.env.example. Copy this file and rename the copy to.env:cp .env.example .env
2. Update the .env file:
Open the newly created .env file and update the following environment variables with your database details:
dotenv
Copy code
`DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=projects_backend
DB_USERNAME=root
DB_PASSWORD=`
- DB_CONNECTION: The database driver, set to mysql for MySQL databases.
- DB_HOST: The hostname where your database is hosted (typically 127.0.0.1 for local development).
- DB_PORT: The port on which your database is running (default is 3306 for MySQL).
- DB_DATABASE: The name of your database (e.g., projects_backend).
- DB_USERNAME: Your database username (e.g., root).
- DB_PASSWORD: Your database password (leave empty if none).
Ensure that the .env file is correctly configured before starting the server.
The backend provides a RESTful API with the following endpoints:
-
Authentication
POST /api/auth/register- Register a new userPOST /api/auth/login- Login a user
-
Projects
GET /api/projects- Get all projectsPOST /api/projects- Create a new projectPUT /api/projects/:id- Update a projectDELETE /api/projects/:id- Delete a project
-
Tasks
GET /api/projects/:projectId/tasks- Get all tasks for a projectPOST /api/projects/:projectId/tasks- Create a new taskPUT /api/projects/:projectId/tasks/:taskId- Update a taskDELETE /api/projects/:projectId/tasks/:taskId- Delete a task
-
Users
GET /api/users- Get all usersGET /api/users/:id- Get a specific userPUT /api/users/:id- Update a userDELETE /api/users/:id- Delete a user