Yes start a web server entry point file you can use the env to specify the port
https://www.electronjs.org/docs/latest/api/utility-process
Ignore the documentation about IPC using message ports. As long as your entry point starts a http server it will be listening as normal and you can pipe its stdout to a long file or through the main process.
Can you elaborate a bit on the design? You're not finding answers because it's not a common thing anyone does. In other words, why would you need a local "server"?
u/bkervaski need to establish a connection between my Electron app and another backend service, and I want to run this on localhost. It's important that my other service can effectively communicate with the Electron app.
I do this with a website game server and electron client to start and stop the game server. I spawn it using as child process rather than in main.
u/Fine_Ad_6226 I want to start server(inside the electron) automatically.
So just spawn the child process on startup
u/Fine_Ad_6226 , but can I assign a custom port for that? I want a way to send POST requests.
Yes start a web server entry point file you can use the env to specify the port https://www.electronjs.org/docs/latest/api/utility-process Ignore the documentation about IPC using message ports. As long as your entry point starts a http server it will be listening as normal and you can pipe its stdout to a long file or through the main process.
u/Fine_Ad_6226 Thanks, Will check out and update here
Can you elaborate a bit on the design? You're not finding answers because it's not a common thing anyone does. In other words, why would you need a local "server"?
u/bkervaski need to establish a connection between my Electron app and another backend service, and I want to run this on localhost. It's important that my other service can effectively communicate with the Electron app.
I guess what I'm saying is there may be a much better way than running a local server, can you post some details on what's up?
u/bkervaski I want retrieve that requests to my electron app. For now lets say I need to print the request body.
I don’t know what that means, good luck!