diff --git a/README.md b/README.md index 64f72f3..2035936 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Before you start this tutorial it is you need to fulfill all the requirements li ``` -1. Node JS and MySQL installed on your PC. +1. Node JS, Nodemon and MySQL installed on your PC. 2. It is better to have a basic understanding of Node JS, Express JS and MySQL queries. 3. A text editor or IDE of your choice. ``` @@ -30,7 +30,7 @@ npm install ``` -## Creating the database for the app +## Creating the database and tables for the app ```sql @@ -137,24 +137,18 @@ ALTER TABLE `products` ## Database connection -inside app.js file +create rename .env.example to .env and setup your ENV varaibales ```node -// the mysql.createConnection function takes in a configuration object which contains host, user, password and the database name. -const db = mysql.createConnection ({ - host: 'localhost', // host name - user: 'root', // username of your database - password: 'root', // password your application - database: 'app1'// database name of your application -}); - -// connect to database -db.connect((err) => { - if (err) { - throw err; - } - console.log('Connected to database'); -}); +# .env.example +NODE_ENV=development +PORT=8000 + +# Set your database connection information here +DATABASE_HOST=192.168.56.111 +DATABASE_NAME=app1 +DATABASE_USER=homestead +DATABASE_PASSWORD=secret ``` ### Run application diff --git a/package.json b/package.json index 84c8055..3038777 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,7 @@ "dotenv": "^6.2.0", "ejs": "^2.6.1", "express": "^4.16.4", - "mysql": "^2.16.0", - "req-flash": "0.0.3" + "mysql": "^2.16.0" }, "devDependencies": { "nodemon": "^1.18.10"