Skip to content

Commit

Permalink
Merge pull request #475 from vamshi726/doc/add-env-example
Browse files Browse the repository at this point in the history
Added env.example File for Environment Variable Configuration
  • Loading branch information
hustlerZzZ authored Aug 4, 2024
2 parents 9ddfdc7 + ae07fd8 commit 61d4381
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 10 deletions.
27 changes: 18 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):** <br>
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):** <br>
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):**<br>
8. **Start the React App (with Backend Running):**<br>
After navigating run the following command to start the React app with the backend server running successfully:
```bash
npm start
Expand Down Expand Up @@ -202,7 +212,6 @@ To learn React, check out the [React documentation](https://reactjs.org/).

![Contributors](https://contrib.rocks/image?repo=VanshKing30/FoodiesWeb)<br>


</div>

<p align="right">(<a href="#top">Back to top</a>)</p>
34 changes: 34 additions & 0 deletions server/.env.example
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion server/routes/errorHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function generalErrorHandler(err, req, res, next) {
message: 'Something went wrong!'
});
}
}
}

// 404 Not Found handler
function notFoundHandler(req, res, next) {
Expand Down

0 comments on commit 61d4381

Please sign in to comment.