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 1 year ago
JSON representation
:electron: Lightweight GraphQL server & client for Electron apps. (WIP)
- Host: GitHub
- URL: https://github.com/firede/electron-graphql
- Owner: firede
- License: mit
- Created: 2018-01-17T08:09:00.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-14T06:13:19.000Z (almost 8 years ago)
- Last Synced: 2024-10-06T20:46:48.239Z (over 1 year ago)
- Topics: electron, electron-graphql, graphql, ipc
- Language: TypeScript
- Homepage:
- Size: 122 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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: