Skip to content

Instantly share code, notes, and snippets.

@tarusharora
Last active February 19, 2019 09:27
Show Gist options
  • Save tarusharora/93852e44b047899e447f0339d129b8e8 to your computer and use it in GitHub Desktop.
Save tarusharora/93852e44b047899e447f0339d129b8e8 to your computer and use it in GitHub Desktop.
app.js with mongo connector
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