简体   繁体   中英

How to run separate node server in electron app

I'm building an Electron app using React. I couldn't get the native node module "printer" to work in electron. There were problems while rebuilding native node module. I need the list of printers that are connected to the device in my app. Then print text using specific printer. So I decided to run an express server separate from electron. Express app needs to have its own node_modules and package.json. And client side will connect the local node server via http request to localhost.

Is it possible to do so? How can I add express app to the dist folder which is created by electron-builder and make it run when electron app is launched?

There is already a way to way the native printing functionality in electron. Please follow the below link. https://www.electronjs.org/docs/api/web-contents#contentsgetprinters

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM