Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/firede/electron-graphql

:electron: Lightweight GraphQL server & client for Electron apps. (WIP)
https://github.com/firede/electron-graphql

electron electron-graphql graphql ipc

Last synced: about 2 months ago
JSON representation

:electron: Lightweight GraphQL server & client for Electron apps. (WIP)

Awesome Lists containing this project

README

        

# electron-graphql

Lightweight GraphQL server & client for Electron apps.

This project is **WORK IN PROGRESS**, do **NOT** try to use it :trollface:

# Installation

```sh
npm i electron-graphql
```

## Usage

### main progress

```js
// `executor` only works in main progress
const { createGraphQLExecutor } = require("electron-graphql")

// create GraphQL executor
const gqlExecutor = createGraphQLExecutor({
// electron IPC channel (base name)
channel,
schema,
rootValue,
contextValue
})

// init GraphQL executor
gqlExecutor.init()

// dispose GraphQL executor
gqlExecutor.dispose()
```

### renderer process

```js
// `fetcher` only works in renderer process
import { createGraphQLFetcher } from "electron-graphql"

// create GraphQL fetcher
const gqlFetcher = createGraphQLFetcher({ channel, timeout })

// init GraphQL fetcher
gqlFetcher.init()

// use GraphQL fetch
gqlFetcher.fetch({ query, variables, operationName })
.then(result => {
const { data, errors, extensions } = result
// GraphQL errors and extensions are optional
})
.catch(error => {
//respond to a connect error
})

// dispose GraphQL fetcher
gqlFetcher.dispose()
```

## API

(TODO).

---

MIT © Firede, built with :coffee: & :sparkling_heart: