adds src/services/connectToDB.js file which provides a function to connect to the mongo database
adds src/services/test-service.js file which prepares a "Test" schema model, and a get all method to fetch test documents from Test collection in database
adds src/routes/testDbRoute.js file which is a very basic route to see if the above to files work as intended
modifies src/routes/index/js file to mount the above test route
Usage
To test, get the database connection string details (secret!) and add to backend-api/.env file under MONGO_URL variable (if not already created). Start the server, and open http://localhost:8080/tests in a browser to see test collection documents retrieved from database. You can manually add or delete documents in the database through the mongodb Atlas account.
What has been done?
src/services/connectToDB.js
file which provides a function to connect to the mongo databasesrc/services/test-service.js
file which prepares a "Test" schema model, and a get all method to fetch test documents from Test collection in databasesrc/routes/testDbRoute.js
file which is a very basic route to see if the above to files work as intendedsrc/routes/index/js
file to mount the above test routeUsage
To test, get the database connection string details (secret!) and add to
backend-api/.env
file under MONGO_URL variable (if not already created). Start the server, and open http://localhost:8080/tests in a browser to see test collection documents retrieved from database. You can manually add or delete documents in the database through the mongodb Atlas account.