frankhale / electron-with-express

A simple app that demonstrates spawning an Express app from Electron
MIT License
643 stars 147 forks source link

electron-with-express rewrite #21

Closed frankhale closed 4 years ago

frankhale commented 5 years ago

electron-with-express is getting a rewrite!!! The current code is showing it's age so things are going to change a bit and get much more modern. The current state of the rewrite is in the rewrite branch. There are some things that still need to be worked out but it's already working. I will need to take some time to update the README to make all the steps necessary to run this thing documented.

Here are the core things being used to modernize this code:

Rough edges / Things that will be fixed:

frankhale commented 5 years ago

The following issues will be resolved by this rewrite: #15, #20

frankhale commented 5 years ago

As mentioned above one of the goals of the rewrite is to figure out how to properly account for spawned processes such that they will exit cleanly when closing the app or when we can reasonably determine that something went wrong.

frankhale commented 5 years ago

Referencing issue Referencing issue https://github.com/frankhale/electron-with-express/issues/22

IrosTheBeggar commented 5 years ago

@frankhale I followed this project a while ago when I was looking into combing electron + express for my own project. I already solved a lot of the problems you mentioned here, like adding a material UI and handling spawned processes.

You can see my project here. Thanks for the inspiration

frankhale commented 5 years ago

@IrosTheBeggar That's awesome!!! I will definitely take a look. Thank you for sharing that with me.

EdmarPereira commented 5 years ago

I don't know if somebody did this test, but I have problem to run this app with electron-builder, is there anybody else with the same problem ?

frankhale commented 5 years ago

technically electron-builder, electron-packager, etc... were always beyond the scope of this project because I just never packaged my apps like that so was not that interested in making it work. Additionally I did something here that probably nobody really would do in their app. I bundle the node executable along side Electron so that I can start the server outside of the Electron process. To get the bundlers and packagers to work you simply start the server using Electron running as a traditional Node process. Pretty sure this would fix the issues.

EdmarPereira commented 5 years ago

Thank you very much for the feedback, and the problem was really the one that you explained. My packages related to the back-end were out of the src folder, when I generated the executable, Electron did not see those folders.

frankhale commented 4 years ago

This rewrite still may happen. I wanted to switch to Next.js. I'll reevaluate this soon.

EdmarPereira commented 4 years ago

You are correct but I fund a way for this problem. To start you need to include the backend folder in the include option inside package.json, doing this electron uses nodejs as base you juat need to create a module exports to start the express server and than require it on your electron starter (manin.js). Once you require it will start the express server