Packaging an Express app in Electron



Just wondering what it would take to fully package an Express app that runs on localhost (npm-gui). I got this response in Electron Packager, but I’m not quite sure how to implement it, or if there’s an alternate/easier way to go about this.

Any ideas?



Running express inside of electron isn’t a big deal.

The response from the other thread… to do that you could use the child_process module to spawn a new process and execute your node script that provides the express server. Then you could use something like an ipc channel to communicate to it if needed.

So, to spawn the process…
const cp = require('child_process') let instance = cp.spawn('node',['/path/to/your/script'])

This will load the child_process module, and spawn a new process in the background that executes your script.

I was using this same method a while back to provide a ui for a web server within express.