I have a front end Electron app, and separately have a REST-style server/database (I have used Express and MongoDB). I would like to connect the two. So an action in the electron app can interact with the Express server/Mongo database, such as executing a POST action and creating a new record in the database. I am having trouble finding guidance. Is there a clear way of doing this? Or at least some Electron methods to try out?
Some more details: To use a basic example: say I want to use Electron to build a chat desktop app. I would like two users (on separate machines) to be able to chat with each other, and then have the data of their chat persisted on an external database. To do this in Electron, the closest I have found is to create a separate web app within the Electron shell using mainWindow.loadURL(’[my url]’), probably assisted by the webview tag.
Haven’t gotten that to work, but I would prefer another way anyway. I would like to avoid loading a separate website, and instead have all the frontend be in Electron, with just certain actions within Electron (like uploading a chat message) then hitting a server/database, and being relayed to other clients.
I assume like how Slack must do it in their desktop app, or how I would think other Electron-built apps must work that require persisting data, such as Nylas’ N1 email app.
Any suggestions? Thanks.