Welcome to web development project
This project is a web application with both frontend and backend components.
Before you begin, ensure you have the following installed:
- Node.js and npm
- MongoDB Community Edition
For more details about the initial setup and packages used, refer to the initial commit here.
First, clone this repository:
git clone https://github.com/Sohaib-Snouber/web_project.git-
Navigate to the backend directory:
cd task-manager-backend -
Initialize the npm project:
npm install npm init -y
-
macOS Only: Start the MongoDB service with
brew:brew services start mongodb-community@8.0
Note: On other operating systems, you may need a different setup to start MongoDB.
-
Run the backend server:
node server.js
If everything is set up correctly, you should see the message:
Server is running on port 5001
-
Navigate to the frontend directory:
cd task-manager-frontend -
Install the necessary packages:
npm install
-
Start the frontend development server:
npm start
If the frontend works correctly, it should automatically open a web browser with the frontend webpage.
There are two database options available:
This was already set up in Step 3 of the Backend Setup section.
- Create a cloud MongoDB database.
- Link the database as shown in this commit.
Note:
Using a cloud database for all developers during the development process is not recommended as it may cause conflicts due to differences in model definitions among developers.
To avoid these issues, use the following configuration in server.js file to switch databases:
const dbChoice = 1; // 1 for local, 2 for cloud