File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,12 @@ var bodyParser = require('body-parser'); // pull information from HTML POST (ex
12
12
var methodOverride = require ( 'method-override' ) ; // simulate DELETE and PUT (express4)
13
13
14
14
// configuration ===============================================================
15
- mongoose . connect ( database . url ) ; // connect to mongoDB database on modulus.io
15
+ try {
16
+ mongoose . connect ( database . url ) ;
17
+ } catch ( err )
18
+ {
19
+ console . log ( err ) ;
20
+ } // connect to mongoDB database on modulus.io
16
21
17
22
app . use ( express . static ( __dirname + '/public' ) ) ; // set static path
18
23
app . use ( morgan ( 'dev' ) ) ; // log every request to the console
Original file line number Diff line number Diff line change 1
1
/*eslint-env node */
2
2
3
+ //in case mongodb installed locally
4
+ //var mongourl = process.env.MONGO_URI? process.env.MONGO_URI : 'mongodb://localhost:27017/exampleDb';
5
+
6
+ . .
7
+ var mongourl = process . env . MONGO_URI ? process . env . MONGO_URI : 'mongodb://mongo:27017/exampleDb' ;
8
+
3
9
module . exports = {
4
10
// mongo database connection url
5
- url : process . env . MONGO_URI
11
+ url : mongourl
6
12
} ;
You can’t perform that action at this time.
0 commit comments