To use secure server-side proxy calls to the Gemini API from your Electron app to avoid CORS issues and protect API keys.
Here is the code snippet you can refer to:

In the above code we are using the following key approaches:
- Express.js acts as a proxy server for the Gemini API.
- Uses axios for making secure HTTP requests.
- Protects the Gemini API key by keeping it server-side.
- Handles potential errors gracefully with a 500 response.
Hence, this approach resolves CORS issues and secures API keys by routing Gemini API calls through a backend proxy, ensuring safe and smooth communication.