Skip to content

Commit

Permalink
Ajuste Build:demo
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAlejandroSaenzMeneses committed Feb 23, 2022
1 parent e7e525f commit c4eeafa
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 32 deletions.
3 changes: 3 additions & 0 deletions config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"password": "5b05b7717",
"database": "library-t",
"host": "127.0.0.1",
"logging": false,
"dialect": "postgres",
"define": {
"timestamps": false
Expand All @@ -14,6 +15,7 @@
"password": "5b05b7717",
"database": "library-t",
"host": "127.0.0.1",
"logging": false,
"dialect": "postgres",
"define": {
"timestamps": false
Expand All @@ -24,6 +26,7 @@
"password": "5b05b7717",
"database": "library-t",
"host": "127.0.0.1",
"logging": false,
"dialect": "postgres",
"define": {
"timestamps": false
Expand Down
4 changes: 1 addition & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ const myRouter = require('./src/routes/index.js');
const sequelize = require('./src/dataBase/connection.js');
const cors = require('cors');
const app = express();
require('dotenv').config();
const environment = process.env;
const port = environment.SERVER_PORT;
const port = 3900;

//CORS
app.use(cors());
Expand Down
14 changes: 0 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"main": "index.js",
"scripts": {
"start": "nodemon index.js",
"build:demo":"npx sequelize-cli db:create && npx sequelize-cli db:migrate && npx sequelize-cli db:seed:all",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
Expand All @@ -20,7 +21,6 @@
"dependencies": {
"connect-multiparty": "^2.2.0",
"cors": "^2.8.5",
"dotenv": "^16.0.0",
"express": "^4.17.2",
"luxon": "^2.3.0",
"pg": "^8.7.3",
Expand Down
13 changes: 3 additions & 10 deletions src/dataBase/connection.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
const { Sequelize } = require('sequelize');
require('dotenv').config();
const environment = process.env;
var env = process.env.NODE_ENV || 'development';
var config = require(__dirname + '/../../config/config.json')[env];

const connection = (new Sequelize(environment.DB_NAME, environment.DB_USER, environment.DB_PASS, {
host: environment.DB_HOST,
dialect: 'postgres',
logging: false,
define: {
timestamps: false
}
}));
const connection = (new Sequelize(config.database, config.username, config.password, config));
module.exports = connection;
5 changes: 1 addition & 4 deletions src/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ var basename = path.basename(module.filename);
var env = process.env.NODE_ENV || 'development';
var config = require(__dirname + '/../config/server-config.json')[env];
var db = {};
if (config.use_env_variable) {
var sequelize = new Sequelize(process.env[config.use_env_variable]);
} else {
var sequelize = new Sequelize(config.database, config.username, config.password, config);
}

fs
.readdirSync(__dirname)
.filter(function(file) {
Expand Down

0 comments on commit c4eeafa

Please sign in to comment.