Skip to content

Commit 1783aa2

Browse files
Rodrigo KlosowskiRodrigo Klosowski
Rodrigo Klosowski
authored and
Rodrigo Klosowski
committed
MySQL Driver in API
1 parent e9d8051 commit 1783aa2

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

api/app.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,21 @@ var indexRouter = require('./routes/index');
1010
var usersRouter = require('./routes/users');
1111

1212
var app = express();
13-
//Default port 3000 is already in use by the app
13+
// Default port 3000 is already in use by the app
1414
app.listen(3001);
1515

16-
//Connection to the MySQL database
17-
var connection = mysql.createConnection({
18-
host : 'db',
19-
user : 'root',
20-
password : process.env.MYSQL_ROOT_PASSWORD,
21-
// database : 'dbname'
22-
});
23-
connection.connect(function(err) {
24-
if (err) throw err;
25-
console.log("Connected to db!");
26-
});
16+
// Connection to the MySQL database
17+
// just uncomment the code bellow to connect to the MySQL DATABASE
18+
// var connection = mysql.createConnection({
19+
// host : 'db',
20+
// user : 'root',
21+
// password : process.env.MYSQL_ROOT_PASSWORD,
22+
// database : 'dbname'
23+
// });
24+
// connection.connect(function(err) {
25+
// if (err) throw err;
26+
// console.log("Connected to db!");
27+
// });
2728

2829
// setup cors
2930
app.use(cors())

0 commit comments

Comments
 (0)