diff --git a/app/controllers/auth/helpers/blockUser.js b/app/controllers/auth/helpers/blockUser.js index 217f7d7..7cae2af 100644 --- a/app/controllers/auth/helpers/blockUser.js +++ b/app/controllers/auth/helpers/blockUser.js @@ -1,8 +1,8 @@ const { addHours } = require('date-fns') -const HOURS_TO_BLOCK = 2 - const { buildErrObject } = require('../../../middleware/utils') +const HOURS_TO_BLOCK = 2 + /** * Blocks a user by setting blockExpires to the specified date based on constant HOURS_TO_BLOCK * @param {Object} user - user object diff --git a/clean.js b/clean.js index 285888c..ecc86b8 100644 --- a/clean.js +++ b/clean.js @@ -1,8 +1,8 @@ require('dotenv-safe').config() const initMongo = require('./config/mongo') +const { removeExtensionFromFile } = require('./app/middleware/utils') const fs = require('fs') const modelsPath = `./app/models` -const { removeExtensionFromFile } = require('./app/middleware/utils') initMongo() diff --git a/seed.js b/seed.js index 73b0ed9..0fddccd 100644 --- a/seed.js +++ b/seed.js @@ -1,11 +1,13 @@ require('dotenv-safe').config() const { Seeder } = require('mongo-seeding') const path = require('path') + const config = { database: process.env.MONGO_URI, inputPath: path.resolve(__dirname, './data'), dropDatabase: false } + const seeder = new Seeder(config) const collections = seeder.readCollectionsFromPath(path.resolve('./data')) diff --git a/server.js b/server.js index 5e31c0d..b526a02 100755 --- a/server.js +++ b/server.js @@ -6,11 +6,13 @@ const compression = require('compression') const helmet = require('helmet') const cors = require('cors') const passport = require('passport') -const app = express() const i18n = require('i18n') const initMongo = require('./config/mongo') const path = require('path') +// Setup express app +const app = express() + // Setup express server port from ENV, default: 3000 app.set('port', process.env.PORT || 3000) @@ -64,10 +66,11 @@ app.use(passport.initialize()) app.use(compression()) app.use(helmet()) app.use(express.static('public')) +app.use(require('./app/routes')) app.set('views', path.join(__dirname, 'views')) -app.engine('html', require('ejs').renderFile) app.set('view engine', 'html') -app.use(require('./app/routes')) +app.engine('html', require('ejs').renderFile) + app.listen(app.get('port')) // Init MongoDB