Skip to content

Commit

Permalink
Added config.js to make cloning simple.
Browse files Browse the repository at this point in the history
  • Loading branch information
dheeraj70 committed Mar 12, 2024
1 parent dacd82c commit 209e352
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/frontend/recipegram/node_modules
/backend/node_modules
/backend/uploads
README!!!.txt
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ Live here: https://recipegram.site/

### Installation:
1. Clone the repository: `git clone https://github.com/dheeraj70/RecipeGram`
2. Navigate to the backend folder: `cd backend`
3. Install backend dependencies: `npm install`
4. Set up MySQL database `subscribe`
5. Run backend server: `node index.js`
6. Navigate to the frontend folder: `cd ../frontend/recipegram`
7. Install frontend dependencies: `npm install`
8. Run frontend server: `npm start`
9. Open your browser and navigate to `http://localhost:3000` to view the app.
2. Open config.js and rename the host, user, password according to your local mysql server.
3. Open CLI and run `mysql -u <your_username> -p` then enter your password.
4. Run `source script.sql`. This will load sample data which is needed for project to run.
5. Alternatively you can run the script.sql on Mysql Workbench.
6. Navigate to the backend folder: `cd backend`
7. Install backend dependencies: `npm install`
8. Run backend server: `node index.js`
9. Navigate to the frontend folder: `cd ../frontend/recipegram`
10. Install frontend dependencies: `npm install`
11. Run frontend server: `npm start`
12. Open your browser and navigate to `http://localhost:3000` to view the app.

### Contributing:
Contributions are welcome! Feel free to submit bug reports, feature requests, or pull requests to help improve RecipeGram.
Expand Down
11 changes: 2 additions & 9 deletions backend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const cors = require('cors')
const store = new session.MemoryStore();
const path = require('path');
const { off } = require('process');
const config = require('../config.js');

const app = express();
const port = 8080;
Expand Down Expand Up @@ -39,15 +40,7 @@ app.use(passport.initialize());
app.use(passport.session());


const db = mysql.createPool({
host: 'localhost',
user: 'root',
password: 'pass123',
database: 'subscribe',
waitForConnections: true,
connectionLimit: 50,
queueLimit: 0
});
const db = mysql.createPool(config.database);
/*
db.connect((err) => {
if (err) {
Expand Down
12 changes: 12 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
// Database configuration
database: {
host: 'localhost', //write your host name
user: 'root', // write your user name
password: 'pass123', // write your password
database: 'subscribe',
waitForConnections: true,
connectionLimit: 50,
queueLimit: 0
}
};
Loading

0 comments on commit 209e352

Please sign in to comment.