I'm learning Electron and everything I'm seeing is using the file:// protocol to load pages, and so far this is working fine. I also see some references to using Express within Electron.
My question is - is there any reason to use a web server such as Express within an Electron app? What does it get you?
Thanks.
I think the scenario is pretty odd: The combination of a desktop-UI with a server-framework seems to be somewhat counter-intuitive.
What you see when file:// is referenced are (local) file system calls - these could well be calls to other protocols like http:// or ws:// instead, and do not require the Express framework to be present.
Instead, Express enables your application to receive connections from the outside and act as a server. This could be a webserver serving static or dynamic content, a REST-API endpoint or some other kind of web service endpoint.
There is indeed a project showing exactly this combination: The Express server is responsible for serving content, Electron is used to wrap a logging-UI that displays whatever is currently happening.
From an architecturial standpoint however, I would probably seperate each of these concerns into seperate standalone applications.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With