Created
August 30, 2020 22:32
-
-
Save amenpunk/b08a280665c7fd261be68e7be755ff99 to your computer and use it in GitHub Desktop.
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
| const mysql = require('mysql'); | |
| const dotenv = require("dotenv"); | |
| dotenv.config() | |
| const env = process.env; | |
| var connection = mysql.createConnection({ | |
| host : env.host, | |
| user : env.user, | |
| password : env.password, | |
| database : env.database | |
| }); | |
| connection.query('SELECT 1 + 1 AS solution', function (error, results, fields) { | |
| if (error) throw error; | |
| console.log('The solution is: ', results[0].solution); | |
| }); | |
| connection.end(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment