'node js problem in connecting to sql server
Dialect needs to be explicitly supplied as of v4.0.0 I am trying to connect an existing SQL server file to my node js app
the code in index.js
const Sequelize = require("sequelize");
const sequelize = new Sequelize(dbConfig.DB, dbConfig.USER, {
host: dbConfig.HOST,
port: dbConfig.PORT,
dialect: dbConfig.dialect,
pool: {
max: 5,
min: 0,
acquire: 30000,
idle: 10000
}
});
const db = {};
db.Sequelize = Sequelize;
db.sequelize = sequelize;
db.tutorials = require("./tutorial.model.js")(sequelize, Sequelize);
module.exports = db;```
the db conf
```module.exports = {
HOST: "localhost",
PORT: "1434",
USER: "****",
DB: "***",
dialect: 'mssql',
pool: {
max: 5,
min: 0,
acquire: 30000,
idle: 10000
}
};```
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
