0

I'm having problems with an electron app that makes calls to an API using a server build with express and Node.Js. The problem is that when i build the APP i can't find a way of executing the server in the background. If you know anything please let me know. Thank you!

mtrplx
  • 1
  • 1
    Do you mean something like https://stackoverflow.com/questions/4903570/how-does-one-start-a-node-js-server-as-a-daemon-process – Thomas Sablik Nov 05 '20 at 18:02

1 Answers1

0

I don't know your code looks like but I assume you have something like this:

function createWindow () {
  let win = new BrowserWindow({
    width: 600,
    height: 400,
    webPreferences: {
      nodeIntegration: true
    }
    ...
 });

What you could do is have nodeIntegration: true and then you could include the server files run in your index.html file. <script src=fileServer.js></script>. This allows script files to use node specific functions such as require('express') or something along those lines.
Again I can't help much more because I don't know what your code looks like.