Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added env.example File for Environment Variable Configuration #475

Merged
merged 2 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading