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
84 changes: 79 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"@hounddesk/plugin-firebase-users": "^1.1.9",
"@types/convict": "^5.2.2",
"convict": "^6.0.1",
"mongodb": "^3.6.6",
"typeorm": "^0.2.31"
},
"jest": {
Expand Down
26 changes: 26 additions & 0 deletions src/lib/database.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { MongoClient } from 'mongodb';

// connection uri
const uri = 'mongodb://localhost:27017';

// new MongoClient
const client = new MongoClient(uri, {
useNewUrlParser: true,
useUnifiedTopology: true,
});

async function run() {
try {
// connect client to server
await client.connect();

// establish and verify connection}
await client.db('admin').command({ ping: 1 });
// console.log('Conneted successfully to server');
} catch (error) {
// close client on finish/error
// console.log('Connection error', error);
}
}

run();