Would Express be a good substitute for making an api for Electron versus Electrons api method of Ipc and contextBridge? #10718
Unanswered
delebash
asked this question in
CLI - Electron mode
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have been looking at using Electron as a desktop application so I can run any node module I want such as fs. I used to be able to just set nodeIntegration = true and it just worked even in the render process. However, after recent research I have found that option to be a major security risk. Electron's new approach which Quasar provides out of the box is to use a preload script with your api calls setup using Electrons method of contextBridge and Ipc. I think that setting up an api with this method is a bit messy. You define your api calls in the preload script and then your functions in you main electron application where you can use fs or any other node model. Another issue is that you have to learn about how to program with contextBridge and Ipc. Again for me it is messy. What if instead we used Express to replace the current way of creating an api in Electron. Express is easy and you can provide just an api with clean code instead of putting everything in your Electron main.js file. One of the advantages on Quasar is code once run anywhere. If we use Express in electron we get code once run anywhere. No code modification to run it as a pwa or inside Electron except the Electron main window setup. We do not have to use Express but any light weight api server that can run in node would work. Thoughts on this idea?
Beta Was this translation helpful? Give feedback.
All reactions