1 min readApr 5, 2020
As long as your data is exposed via a REST API then it doesn’t make a difference how the front-end fetches it. In fact that’s the point of separating the back-end concerns from the front-end. You’ll need to look into how to setup your MongoDB as a REST service by following something like this or this.
Once the data are exposed via REST you can use Azle’s call_api function to fetch the data:
az.call_api({
"url" : "url_to_your_mongo_web_service",
"parameters" : {},
"done" : function(data) {
// do something with data
console.log(data)
}
})
It’s just as easy to use the standard fetch API:
fetch(url).then(response => response.text()).then(data => {
my_data = JSON.parse(data)
});
You’ll have to do some research and attempt building.