Skip to content

Commit

Permalink
Avoid hardcoded mongodb url
Browse files Browse the repository at this point in the history
  • Loading branch information
vpodolyan committed Mar 31, 2016
1 parent c01d895 commit ed0cd47
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ let app = express();

app.use(express.static("public"));

// MongoDb url is expected as first cli argument, default url otherwise
let mongoUrl = process.argv[2] ? process.argv[2] : "mongodb://rgrjs:123456@ds025469.mlab.com:25469/rgrjs";
let db
MongoClient.connect(process.env.MONGO_URL, (err, database) => {
MongoClient.connect(mongoUrl, (err, database) => {
if (err) throw err;

db = database;
console.log(process.env.MONGO_URL);
app.listen(3000, () => console.log("Listening on port 3000"));
});

Expand Down

0 comments on commit ed0cd47

Please sign in to comment.