File tree Expand file tree Collapse file tree 4 files changed +15
-3
lines changed Expand file tree Collapse file tree 4 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 5
5
"main" : " index.js" ,
6
6
"scripts" : {
7
7
"start" : " node server/server.js" ,
8
- "test" : " mocha server/**/*.test.js" ,
8
+ "test" : " export NODE_ENV=test || SET \" NODE_ENV=test \" && mocha server/**/*.test.js" ,
9
9
"test-watch" : " nodemon --exec 'npm test'"
10
10
},
11
11
"engines" : {
Original file line number Diff line number Diff line change
1
+ let env = process . env . NODE_ENV || 'development' ;
2
+
3
+
4
+ if ( env === 'development' ) {
5
+ process . env . PORT = 3000 ;
6
+ process . env . MONGODB_URI = 'mongodb://localhost:27017/TodoApp' ;
7
+ } else if ( env === 'test' ) {
8
+ process . env . PORT = 3000 ;
9
+ process . env . MONGODB_URI = 'mongodb://localhost:27017/TodoAppTest' ;
10
+ }
Original file line number Diff line number Diff line change 1
1
let mongoose = require ( 'mongoose' ) ;
2
2
3
3
mongoose . Promise = global . Promise ;
4
- mongoose . connect ( process . env . MONGODB_URI || 'mongodb://localhost:27017/TodoApp' ) ;
4
+ mongoose . connect ( process . env . MONGODB_URI ) ;
5
5
6
6
module . exports = { mongoose} ;
7
7
Original file line number Diff line number Diff line change
1
+ require ( './config/config' ) ;
2
+
1
3
const _ = require ( 'lodash' ) ;
2
4
const express = require ( 'express' ) ;
3
5
const bodyParser = require ( 'body-parser' ) ;
@@ -8,7 +10,7 @@ let {Todo} = require('./models/todo');
8
10
let { User} = require ( './models/user' ) ;
9
11
10
12
let app = express ( ) ;
11
- const port = process . env . PORT || 3000
13
+ const port = process . env . PORT ;
12
14
13
15
app . use ( bodyParser . json ( ) ) ;
14
16
You can’t perform that action at this time.
0 commit comments