Last active
August 12, 2021 16:44
-
-
Save Adurtxi/f01d7de905617ae72bde374faef3ffe4 to your computer and use it in GitHub Desktop.
NodeJS, Express and MySQL -- db.config.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| const mysql = require('mysql2'); | |
| const dbConnection = mysql.createConnection({ | |
| host : 'localhost', | |
| user : 'root', | |
| password : '', | |
| database : 'nodejs_mysql' | |
| }); | |
| dbConnection.connect((err) => { | |
| if (err) throw err; | |
| console.log('Database Connected!'); | |
| }); | |
| module.exports = dbConnection; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment