I have:
In my dev environment I start these as follows:
npm run dev
(on the directory of the express web server). It produces: "Express server listening on port 7000" and is ready to receive requestsnpm start
(on the directory of the client application). This launches the client app in the browser. Then I can type, click buttons and get data (from the web-server) displayed.I want to provide this system to an end user in a convenient way for them:
What is important is not only a convenient installation, but then to be able to start both system components with a single user command. When the user closes the client application, ideally the express web-server should also be closed.
I played with electron.js, but it seems it will not deploy and start the express server that is needed by the electron application. Also read about nw.js but haven't seen any example similar to my scenario.
I know that maybe??? I can implement the server-side as one of the electron renderer processes and, instead of HTTP, use inter-process communication (IPC) to communicate with the client-app (another renderer process) involving the main process in this. However, this would require substantial reworking of this already existing system, which would need significant time and is not affordable at present.
Is the deployment and usage scenario (1, 2, 3 above) possible and what are the best tools to use for implementing such deployment and execution scenario?
Could you provide reference(s) to any such implementations? And/or ideally small/complete code examples?
Yes you can do it. Yo can pack both electron app and express server in the production. In developing you need to develop the express app and execute it using nodejs child-process
module. Here you can use exec
command or spawn
command ( i prefer exec, easy to use). The you can start the express process from you electron main
process. Wait till the express server setup and then move on with the app.
And for the puppeteer I suggest you to take a look in this github thread . They are saying to execute puppeteer on the main process
and communicate the main
and renderer
processes by electron IPC
For building windows installer I think its better to use electron-builder and generate a nsis installer with a signed certificate