electron-client-server

1.0.0-beta • Public • Published

Back-End Server Emulation for Electron Applications

When creating an Electron app, you might find yourself having to deal with interprocess communication (IPC). However, you can use the familiar client-server communication approach from web development. Without starting a local server. For better understanding, please refer to the article.

Installation

npm install electron-client-server electron

Usage

First, import the library in your main module (where the Electron app is initialized):

import { applyProxy } from "electron-client-server"

Then declare a constant containing the URL at which your frontend can reach the backend.

const baseURL = new URL("http://app.local/")

After your Electron app finished initializing, apply the proxy:

app.whenReady().then(() => {
    applyProxy(baseURL, server)
})

There is also an example project in the example folder of the repository.

Package Sidebar

Install

npm i electron-client-server

Weekly Downloads

0

Version

1.0.0-beta

License

Apache-2.0

Unpacked Size

16.5 kB

Total Files

6

Last publish

Collaborators

  • ivteplo