diff --git a/src/routes/api/getGameScore.js b/src/routes/api/getGameScore.js index c96a1e5..5f8a37f 100644 --- a/src/routes/api/getGameScore.js +++ b/src/routes/api/getGameScore.js @@ -2,15 +2,16 @@ const getGameScore = (req, res) => { const { MongoClient } = require('mongodb'); async function main() { - const uri = 'mongodb://mongoadmin:Bijaynagardwd@10.0.0.90:27017'; // Replace with your MongoDB connection string - const client = new MongoClient(uri, { useNewUrlParser: true, useUnifiedTopology: true }); + const url = process.env.MONGODB_URL; + const dbName = process.env.MONGO_DB_NAME; + const client = new MongoClient(url, { useNewUrlParser: true, useUnifiedTopology: true }); try { // Connect to the MongoDB client await client.connect(); // Select the database and collection - const database = client.db('iimttnewdb'); // Replace with your database name + const database = client.db(dbName); // Replace with your database name const collection = database.collection('gameData'); // Replace with your collection name // Find a single document