Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: make it much readable #257

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/controllers/auth/helpers/blockUser.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion clean.js
Original file line number Diff line number Diff line change
@@ -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()

Expand Down
2 changes: 2 additions & 0 deletions seed.js
Original file line number Diff line number Diff line change
@@ -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'))

Expand Down
9 changes: 6 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down