Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
arvind-balaji committed Aug 11, 2018
0 parents commit d2b6e31
Show file tree
Hide file tree
Showing 25 changed files with 17,878 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
git
node_modules
build
npm-debug.log
scrape
.env
.DS_Store
27 changes: 27 additions & 0 deletions db.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const MongoClient = require('mongodb').MongoClient;
const url = "mongodb://192.168.1.163";
var db = null;
MongoClient.connect(url, function(err, client) {
if(err){console.log(err);}
console.log("Connected successfully to database");
const dbName = 'carddb';
db = client.db(dbName);
});


// const db = function() {
// return MongoClient.connect(url, (err, database) => {
// if (err) return console.log(err);
// console.log('connected to db!');
// return database;
// });
// };

module.exports = {
getConnection : function() {
return db;
},
isAvailable : function() {
return db != null;
}
}
Loading

0 comments on commit d2b6e31

Please sign in to comment.