@@ -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.
12122. It is better to have a basic understanding of Node JS, Express JS and MySQL queries.
13133. 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
0 commit comments