Is it possible to run a background server in an Electron app. If so, can we attach start/stop events to it? I'm planning to wrap an existing web app (along with its prod dependencies) inside electron, to make it easily accessible for the end user.
Any help would be appreciated 🙂
Frontend Fanatic
Perhaps not really an answer to you question, but if you want to wrap an existing web application inside of an Electron shell, you should checkout nativefier. With one command you can generate an Electron app for your web application.
@lichtjaeger the previous post was deleted, can you post your answer again?
Peter Scheler
JS enthusiast
Yes, you can.
Electron uses a main process and multiple render-processes. In the main process, you can write your backend logic, the event listeners, and your controllers. The render processes are windows. You can display anything you want within them.
The easiest way is to require your "server.js" in the main process.
Do you want to use Electron as service monitor or as a client too?