Last active
February 19, 2019 09:27
-
-
Save tarusharora/93852e44b047899e447f0339d129b8e8 to your computer and use it in GitHub Desktop.
app.js with mongo connector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const nconf = require('nconf'); | |
const server = require('./server') | |
const { connectMongo } = require('./api/db/db') | |
const { loadSettings } = require('./config/configurationAdaptor') | |
const appSettingsPath = process.env.APP_SETTINGS_FILE_PATH; | |
loadSettings({ appSettingsPath }) | |
.then(() => { | |
const mongoURI = nconf.get('db.mongodb.uri'); | |
connectMongo(mongoURI); | |
// Read the config property required for starting the server | |
const serverOptions = { | |
logSeverity: nconf.get('logSeverity'), | |
}; | |
server.createServer(serverOptions); | |
}) | |
.catch((err) => { | |
console.log(err); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment