I am using ElectronJS
and below is my function that returns data from mongo database (in the main process) :
ipcMain.on('getRequests', (event) => {
return Requests.find({});
});
Requests
in the database has attributes like date, and time.
in the frontend (renderer process), I have the following:
<div id="page-inner">
<div class="row">
<div class="col-md-4 col-sm-4">
<div class="card teal">
<div class="card-content white-text">
<span class="card-title">Attribute1</span>
<p>Attribute2</p>
</div>
<div class="card-action">
<a href="#">Attribute3</a>
<a href="#">Attribute4</a>
</div>
</div>
</div>
</div>
</div>
How can access the elements returned from getRequests
function?
I know about ipcRenderer
. I thought about doing something as follow:
<script>
const ipcRenderer = require('electron').ipcRenderer;
ipcRenderer.send('getRequests');
</script>
I am not sure if the above is correct but even if it was, how will I change the value of Attribute1
, Attribute2
, ... based on the returned value?
NOTE: I am using mongoose