StraMa87

Sequelize Mssql implementation

Oct 31st, 2020
598
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Sequelize = require("sequelize");
  2.  
  3.  
  4. const dbConn = new Sequelize(process.env.Name_Db, process.env.Db_user, process.env.Db_password, {
  5.     dialect:"mssql",
  6.     host:"localhost"
  7.     port:process.env.PORT_DB //porta 1433 di default
  8.     dialectOptions:{
  9.         encrypt:true
  10.     }
  11. })
  12.  
  13. module.exports =dbConn;
  14.  
  15. // NEL FILE SERVER.JS
  16.  
  17. const sequelize = require("./util/db");
  18.  
  19. sequelize
  20. .authenticate()
  21. .then( response => console.log(response) )
  22. .catch( error => console.log(error) );
Advertisement
Add Comment
Please, Sign In to add comment