diff --git a/app.js b/app.js index 3625819..ebcc2b5 100644 --- a/app.js +++ b/app.js @@ -39,11 +39,12 @@ app.use((err, req, res) => { res.render("error"); }); -db.sequelize.sync({ force: false }); +db.sequelize.sync({ force: false }).then(()=>{ + app.listen(port, () => { + // eslint-disable-next-line no-console + console.log(`Servidor funcionando en el puerto ${port}`); + }); +}) -app.listen(port, () => { - // eslint-disable-next-line no-console - console.log(`Servidor funcionando en el puerto ${port}`); -}); module.exports = app; diff --git a/config/config.js b/config/config.js index 1f546be..6693f55 100644 --- a/config/config.js +++ b/config/config.js @@ -1,7 +1,6 @@ require("dotenv").config(); module.exports = { - SECRET: "AlkemyBank", development: { username: process.env.DB_USER, password: process.env.DB_PASSWORD, @@ -9,6 +8,8 @@ module.exports = { host: process.env.DB_HOST, port: process.env.DB_PORT, dialect: "mysql", + logging: false, // set to console.log to see the raw SQL queries + native: false, // lets Sequelize know we can use pg-native for ~30% more speed }, production: { @@ -18,5 +19,19 @@ module.exports = { host: process.env.DB_HOST, port: process.env.DB_PORT, dialect: "mysql", + pool: { + max: 3, + min: 1, + idle: 10000, + }, + dialectOptions: { + ssl: { + require: true, + // Ref.: https://github.com/brianc/node-postgres/issues/2009 + rejectUnauthorized: false, + }, + keepAlive: true, + }, + ssl: true, }, };