REST API upgrade

This commit is contained in:
C
2022-12-14 19:03:49 +05:00
parent 288718779d
commit 39790bdd2a
25 changed files with 1010 additions and 3767 deletions
+17
View File
@@ -0,0 +1,17 @@
const { MongoClient } = require("mongodb")
const { mongodb_url, database_name } = require('../config.json')
const client = new MongoClient(mongodb_url)
let database
// throw exception
module.exports.get_db = async () => {
try {
await client.connect()
database = client.db(database_name)
} catch (e) {
throw e
}
return database
}