Skip to content

Commit 0f6ee65

Browse files
committed
Ready for deploying on AWS
1 parent 93e6c01 commit 0f6ee65

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

app.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const dotenv = require("dotenv");
22
dotenv.config();
33

44
const express = require('express');
5-
const port = 9000;
5+
const PORT = process.env.PORT || 9000;
66
const app = express();
77

88
//parse the form data sent with post request
@@ -41,11 +41,11 @@ ResetPassword.belongsTo(User);
4141

4242
//{ force: true } - it is writen in sync(), when we want to crate the fresh tabel or update the table or table schema
4343
sequelize.sync().then((result) => { // ? How this .sync find the all module for creating table
44-
app.listen(port, function (err) {
44+
app.listen(PORT, function (err) {
4545
if (err) {
4646
console.log(`Error in running the server: ${err}`);
4747
}
48-
console.log(`Server is running on port: ${port}`);
48+
console.log(`Server is running on port: ${PORT}`);
4949
});
5050
}).catch((err) => {
5151
console.log(err);

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "Fullstack Web Application for Expense Tracker",
55
"main": "app.js",
66
"scripts": {
7-
"start": "nodemon index.js",
7+
"start": "node app.js",
8+
"dev": "nodemon app.js",
89
"test": "echo \"Error: no test specified\" && exit 1"
910
},
1011
"keywords": [

util/database.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
const Sequelize = require("sequelize");
2-
const sequelize = new Sequelize('expense_web-app_sql', 'root', 'Sql@2022',
2+
const sequelize = new Sequelize(process.env.DB_SCHEMA, process.env.DB_USER, process.env.DB_PASSWORD,
33
{
44
dialect: "mysql",
5-
host: "localhost"
5+
host: process.env.DB_HOST
66
}
77
);
88

0 commit comments

Comments
 (0)