Nukem's Possible Manifestation

    electron-graphql
    TypeScript icon, indicating that this package has built-in type declarations

    0.2.1 • Public • Published

    electron-graphql

    Lightweight GraphQL server & client for Electron apps.

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

    Installation

    npm i electron-graphql

    Usage

    main progress

    // `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

    // `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:

    Install

    npm i electron-graphql

    DownloadsWeekly Downloads

    3

    Version

    0.2.1

    License

    MIT

    Last publish

    Collaborators

    • firede