File tree 2 files changed +4
-3
lines changed
2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change 1
- web : node server.js
1
+ web : npm start
Original file line number Diff line number Diff line change 1
1
var express = require ( 'express' ) , // Call express
2
2
app = express ( ) , // Define our app using express
3
3
port = process . env . PORT || 3000 , // Set the port
4
+ dbUrl = process . env . MONGODB_URI || 'mongodb://localhost/tasksdb' ,
4
5
mongoose = require ( 'mongoose' ) , // Call mongoose to interact with a MongoDB(Database) instance
5
6
Task = require ( './api/models/tasksModel' ) , // Created model loading here
6
7
bodyParser = require ( 'body-parser' ) ; //Middleware to process incoming request body objects
7
8
8
9
// Mongoose instance connection url connection
9
10
mongoose . Promise = global . Promise ;
10
- mongoose . connect ( 'mongodb://localhost/tasksdb' ) ;
11
+ mongoose . connect ( dbUrl ) ;
11
12
12
13
/* Configure app to use bodyParser()
13
14
this will let us get the data from a POST */
@@ -22,7 +23,7 @@ routes(app);
22
23
23
24
// Start the server
24
25
app . listen ( port ) ;
25
- console . log ( 'RESTful API demo server started on: ' + port ) ;
26
+ console . log ( 'RESTful API demo server started on: ' + `http://localhost: ${ port } /` ) ;
26
27
27
28
// Get an instance of the express Router
28
29
var router = express . Router ( ) ;
You can’t perform that action at this time.
0 commit comments