Skip to content

Commit a476eed

Browse files
committed
Updated database connection string
1 parent 66ea48b commit a476eed

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Procfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
web: node server.js
1+
web: npm start

server.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
var express = require('express'), // Call express
22
app = express(), // Define our app using express
33
port = process.env.PORT || 3000, // Set the port
4+
dbUrl = process.env.MONGODB_URI || 'mongodb://localhost/tasksdb',
45
mongoose = require('mongoose'), // Call mongoose to interact with a MongoDB(Database) instance
56
Task = require('./api/models/tasksModel'), // Created model loading here
67
bodyParser = require('body-parser'); //Middleware to process incoming request body objects
78

89
// Mongoose instance connection url connection
910
mongoose.Promise = global.Promise;
10-
mongoose.connect('mongodb://localhost/tasksdb');
11+
mongoose.connect(dbUrl);
1112

1213
/* Configure app to use bodyParser()
1314
this will let us get the data from a POST */
@@ -22,7 +23,7 @@ routes(app);
2223

2324
// Start the server
2425
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}/`);
2627

2728
// Get an instance of the express Router
2829
var router = express.Router();

0 commit comments

Comments
 (0)