-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d2b6e31
Showing
25 changed files
with
17,878 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
Oops, something went wrong.