Spaces:
Sleeping
Sleeping
Create dbconnection.js
Browse files- dbconnection.js +19 -0
dbconnection.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { MongoClient, ServerApiVersion } from 'mongodb';
|
| 2 |
+
const uri = "mongodb+srv://junaid:junaid@cluster0.0ec6y.mongodb.net/?appName=Cluster0";
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
const client = new MongoClient(uri, {
|
| 6 |
+
serverApi: {
|
| 7 |
+
version: ServerApiVersion.v1,
|
| 8 |
+
strict: true,
|
| 9 |
+
deprecationErrors: true,
|
| 10 |
+
}
|
| 11 |
+
});
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
function provideClient() {
|
| 16 |
+
return client;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
export {provideClient}
|