Skip to content

Commit a60375e

Browse files
committed
Readme updated
1 parent 19280dc commit a60375e

File tree

2 files changed

+13
-20
lines changed

2 files changed

+13
-20
lines changed

Diff for: README.md

+12-18
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Before you start this tutorial it is you need to fulfill all the requirements li
88

99

1010
```
11-
1. Node JS and MySQL installed on your PC.
11+
1. Node JS, Nodemon and MySQL installed on your PC.
1212
2. It is better to have a basic understanding of Node JS, Express JS and MySQL queries.
1313
3. A text editor or IDE of your choice.
1414
```
@@ -30,7 +30,7 @@ npm install
3030
```
3131

3232

33-
## Creating the database for the app
33+
## Creating the database and tables for the app
3434

3535
```sql
3636

@@ -137,24 +137,18 @@ ALTER TABLE `products`
137137

138138
## Database connection
139139

140-
inside app.js file
140+
create rename .env.example to .env and setup your ENV varaibales
141141

142142
```node
143-
// the mysql.createConnection function takes in a configuration object which contains host, user, password and the database name.
144-
const db = mysql.createConnection ({
145-
host: 'localhost', // host name
146-
user: 'root', // username of your database
147-
password: 'root', // password your application
148-
database: 'app1'// database name of your application
149-
});
150-
151-
// connect to database
152-
db.connect((err) => {
153-
if (err) {
154-
throw err;
155-
}
156-
console.log('Connected to database');
157-
});
143+
# .env.example
144+
NODE_ENV=development
145+
PORT=8000
146+
147+
# Set your database connection information here
148+
DATABASE_HOST=192.168.56.111
149+
DATABASE_NAME=app1
150+
DATABASE_USER=homestead
151+
DATABASE_PASSWORD=secret
158152
```
159153

160154
### Run application

Diff for: package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
"dotenv": "^6.2.0",
1717
"ejs": "^2.6.1",
1818
"express": "^4.16.4",
19-
"mysql": "^2.16.0",
20-
"req-flash": "0.0.3"
19+
"mysql": "^2.16.0"
2120
},
2221
"devDependencies": {
2322
"nodemon": "^1.18.10"

0 commit comments

Comments
 (0)