I have an API that I used with MySQL, but I had to switch to SQL Server. Unfortunately I've never used SQL Server, I do not know if I need to download something to get it. The API was done in JS. The configuration of the sequelize of my API with MYSQL was like this:
const Sequelize = require('sequelize');
const config = {
user: "root",
database: "api",
password: "",
host: "localhost",
port: 3306,
dialect: 'mysql',
max: 10000,
idleTimeoutMillis: 3000
};
const seq = new Sequelize(
config.database,
config.user,
config.password,
{
host:config.host,
dialect:config.dialect,
port:config.port,
logging: false,
pool: {
max: config.max,
min: 0,
idle: config.idleTimeoutMillis
}
}
);
module.exports = seq
I made the following change to test with sql server:
const Sequelize = require('sequelize');
const config = {
user: "sa",
database: "dbPortal",
password: "",
host: "localhost",
port: 1433,
dialect: 'mssql',
max: 10000,
idleTimeoutMillis: 3000
};
const seq = new Sequelize(
config.database,
config.user,
config.password,
{
host:config.host,
dialect:config.dialect,
port:config.port,
logging: false,
pool: {
max: config.max,
min: 0,
idle: config.idleTimeoutMillis
}
}
);
module.exports = seq
When I call the API it says it was connected, but then it says it was not. When I test it, it is POST, it gives some red errors in the prompt.
Does anyone know how to configure it to work in SQL Server?