Electron build
-
Hi,
I developed a small Quasar app with SSR following instructions and using /src-ssr/extension.js (Sequelize & SQLite) as Backend, everything runs properly on the browser, when I compile for Electron it doesn’t reach Node/Express route
I already add app.use(ssr.resolveUrl(’/api/empleados’) on the routes but it seems something with the port, I also changed to another one but no luck… Am I missing something? would you please guys help me?
Thanks -
@operez2000 The express server under src-ssr does not run with Electron. You would have to re-create the express api under src-electron. You could share code between the two and require the shared code in both src-ssr and src-electron. But it’s not always the best idea to run a server locally this way, depending on your security model since the endpoint is completely exposed to any process running on that user’s computer. Also, the user might be running something else on that port (which can be solved by using a randomized port on start.)
But better yet is to use electron’s ipc to communicate from the frontend to the backend. It would require some more work to make the frontend either call ipcRenderer or axios depending on the mode. You still could share code between ssr and electron, but it involves more work.