diff --git a/README.md b/README.md index 73d5ed3..95b77dc 100644 --- a/README.md +++ b/README.md @@ -98,33 +98,43 @@ Welcome to Foodies, your go-to college dining companion! Designed for seamless c cd server ``` 5. **Install Dependencies (in both terminals):** + ```bash npm install ``` +6. **Setup Environment Variables** + + ```bash + cp .env.example .env + ``` + ### **ENV Variables** + Setup MongoDB local host instance and port in env file in your local device. Default port is 4000 Sample uri is given below. + ``` PORT=3000 DATABASE_URL="http://localhost:21713/foods" EMAIL="The email from which forgot the password email will be sent" MAILPASS="password for the email ( app password )" - ``` + ``` + ### **STEP TO GENERATE APP PASSWORD** - 1) Enable 2-step verification if not - **In https://myaccount.google.com/security, do you see 2-step verification set to ON** - - 2) Generate APP PASSWORD by clicking on below link - **https://myaccount.google.com/apppasswords?rapt=AEjHL4PAhcbtFEpLwfNtVix3bfiGe71GdrW_Naiuvp_NVnMZyTd0UR07M2mVnEyWzkw9kB99YVhhfEVtjxTi3QWSZ39biK-zGwnghm0u778vwmlh6TFbmh4** + 1. Enable 2-step verification if not + **In https://myaccount.google.com/security, do you see 2-step verification set to ON** -6. **Start the Backend Server (in the terminal within the /server directory):**
+ 2. Generate APP PASSWORD by clicking on below link + **https://myaccount.google.com/apppasswords?rapt=AEjHL4PAhcbtFEpLwfNtVix3bfiGe71GdrW_Naiuvp_NVnMZyTd0UR07M2mVnEyWzkw9kB99YVhhfEVtjxTi3QWSZ39biK-zGwnghm0u778vwmlh6TFbmh4** + +7. **Start the Backend Server (in the terminal within the /server directory):**
In the terminal where you navigated to the /server directory, run the following command to start the backend server: ```bash nodemon server.js ``` -7. **Start the React App (with Backend Running):**
+8. **Start the React App (with Backend Running):**
After navigating run the following command to start the React app with the backend server running successfully: ```bash npm start @@ -202,7 +212,6 @@ To learn React, check out the [React documentation](https://reactjs.org/). ![Contributors](https://contrib.rocks/image?repo=VanshKing30/FoodiesWeb)
-

(Back to top)

diff --git a/server/.env.example b/server/.env.example new file mode 100644 index 0000000..d3e87fe --- /dev/null +++ b/server/.env.example @@ -0,0 +1,34 @@ +# MongoDB connection string +# Replace with your MongoDB URI. If using a local MongoDB instance, this is the default URI +DATABASE_URL=mongodb://127.0.0.1:27017/Foodiesweb + + +# Cloudinary credentials +# Sign up or log in at https://cloudinary.com/ +# Find your Cloudinary Cloud Name, API Key, and API Secret in the Dashboard under Account Details +CLOUDINARY_CLOUD_NAME=YOUR_CLOUDINARY_CLOUD_NAME +CLOUDINARY_API_KEY=YOUR_CLOUDINARY_API_KEY +CLOUDINARY_API_SECRET=YOUR_CLOUDINARY_API_SECRET + +# Google OAuth credentials +# Go to https://console.developers.google.com/ +# Create a new project, then go to "Credentials" +# Create OAuth 2.0 Client IDs to get the Client ID and Client Secret +GOOGLE_CLIENT_ID=YOUR_GOOGLE_CLIENT_ID +GOOGLE_CLIENT_SECRET=YOUR_GOOGLE_CLIENT_SECRET + +# JWT secret +# This is a secret key used for signing JSON Web Tokens +# You can generate a random secret key using online tools or manually create one +JWT_SECRET=YOUR_JWT_SECRET + +# Email credentials for sending emails +# If using Gmail, enable "Less secure app access" or use an app-specific password +EMAIL=YOUR_EMAIL_ADDRESS +MAILPASS=YOUR_EMAIL_PASSWORD + + + +# Node environment +# Set the environment to 'development' or 'production' +NODE_ENV=development diff --git a/server/routes/errorHandlers.js b/server/routes/errorHandlers.js index a01cb47..7dd0128 100644 --- a/server/routes/errorHandlers.js +++ b/server/routes/errorHandlers.js @@ -18,7 +18,7 @@ function generalErrorHandler(err, req, res, next) { message: 'Something went wrong!' }); } -} +} // 404 Not Found handler function notFoundHandler(req, res, next) {