forked from evanbechtol/bare-express
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
25 lines (21 loc) · 663 Bytes
/
index.js
File metadata and controls
25 lines (21 loc) · 663 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const config = require( "./config" );
const mongoose = require( "mongoose" );
const logger = require( "./services/Logger" );
const mongooseOptions = {
useUnifiedTopology: true,
useNewUrlParser: true
};
mongoose.Promise = global.Promise;
// Connect to the DB an initialize the app if successful
mongoose.connect( config.dbUrl, mongooseOptions )
.then( () => {
logger.info( "Database connection successful" );
// Create express instance to setup API
const ExpressLoader = require( "./loaders/Express" );
new ExpressLoader();
} )
.catch( err => {
//eslint-disable-next-line
console.error( err );
logger.error( err );
} );