I've inherited a web application, whose backend is written in Go Lang and uses gRPC and protocol buffers to communicate with the Angular 8 frontend. The old developer was using Wails to bind Go method to the frontend and to build an exe, as required.
Based on the client needs, we decided to stop using Wails and to switch to Electron (14.0.0).
I was wondering if there is a method to use gRPC with Electron. All the tutorials I've found concerns older versions of Electron.
I previously used Wails V2, while its does very good job. but its kinda limited. I switched to Electron.
I had a similar setup. a Backend server in Go and frontend in Svelte. I used HTTP server instead of gRPC. bud the process is the same.
So, when bundling your app in electron. you will need to add the binary of the backend to additional resources.
And then, from the frontend you start and connect to the grpc backend server. using https://github.com/grpc/grpc-node. like this
In my case i used electron builder (https://www.electron.build/) to build my app.
you can use
extraResourcesdirective to add your backend binary to electron app.https://www.electron.build/configuration/contents.html#extraresources
or
binaries: ["bin/windows/app.exe"]asarUnpack: ["bin/windows/app.exe"]my app was for MacOS and
electron-builder.yamllooks like this.Example of electron builder config:https://github.com/twiny/svelte-electron-tailwind/blob/main/electron-builder.yml