Last active
November 2, 2020 01:29
-
-
Save Bomfim/2014968db08844c7dc6e2880c044a9cf to your computer and use it in GitHub Desktop.
config/db.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
| const { Sequelize } = require("sequelize"); | |
| const dbConnection = new Sequelize("plansdb", "plansdb", "passwd", { | |
| host: "den1.mssql7.gear.host", | |
| dialect: "mssql", | |
| dialectOptions: { | |
| options: { | |
| validateBulkLoadParameters: true, | |
| }, | |
| encrypt: true, | |
| requestTimeout: 30000, // timeout = 30 seconds | |
| }, | |
| }); | |
| const testConnection = async function () { | |
| try { | |
| await dbConnection.authenticate(); | |
| console.log("Connection has been established successfully."); | |
| } catch (error) { | |
| console.error("Unable to connect to the database:", error); | |
| } | |
| }; | |
| module.exports = { | |
| dbConnection, | |
| testConnection, | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment