Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions stackle_api/config/database.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
module.exports = {
url: process.env.LOCAL_DB || "mongodb://localhost/main",
testurl: "mongodb://localhost/node-test",
url: process.env.LOCAL_DB || "mongodb://localhost:27017/main",
testurl: "mongodb://localhost:27017/node-test",
alturl: "mongodb://ordinary:H3ll0w0rld@ds149201.mlab.com:49201/stackle",
option: function(version) {
var opt;
if (version < '5') {
opt = {
useMongoClient: true

};
}
else
{
opt=
{
useNewUrlParser: true
}
}
return opt;
}
};
Expand Down
2 changes: 1 addition & 1 deletion stackle_api/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ if(app.get('env') === 'test'){
console.log('Testing ... \n');
}

mongoose.connect(database.url, option, function (err) {
mongoose.connect(database.url, option, function (err) {
console.log("Connecting to the database...");
if (err) {
console.log("\nCouldn't connect to local database. Please make sure your local mongodb server is running. \nFind more: https://github.com/scorelab/Stackle#installing-mongodb\n\nConnecting to alternative remote (mongolab) database ...");
Expand Down