Would you use Express in an Electron App?


#1

I’m brand new to Electron, but I’ve built many web apps using MEAN.

I was reading about how Electron has a main and a renderer process and how we communicate between the two using Eletron’s IPC library.

But would it make sense instead to just treat it like a real web application and put Express in the main process and the client files in the renderer process. Then they would communicate via http/ajax instead of interprocess communication?

Sorry if this sounds stupid…


#2

You could and some people have, but bear in mind that this would incur the overhead of HTTP protocol and the full networking stack. So it would have lower performance than the simple pipe used for IPC. It depends on what you want to do and whether you would be running it on devices with weaker processors.


#3

Ah, I see. Thanks erikwallace-lewdewe.

I was also thinking that file I/O would be more complicated using the full stack web application model as well.


#4

Another thing to keep in mind is that any website the user loads in an external browser can access the Express server you spin up on the user’s machine. I suspect a lot of people spinning up Express on user machines have given little thought to the associated security concerns.


#5

Yes, great point! Thanks enlight! Electron really is an intersecting framework. It’s like the wild west!