New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lokka-transport-graphql-js

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lokka-transport-graphql-js

Local Schema Transport for Lokka

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
652
increased by34.43%
Maintainers
1
Weekly downloads
 
Created
Source

lokka-transport-local

Local Schema Transport Layer for Lokka


This is a transport layer for wrapping Lokka around your graphql-js schema without going over the network.

Basic Usage

Install the package:

npm i --save lokka-transport-graphql-js
npm i --save lokka

This is how to send request to Facebook's SWAPI GraphQL Demo.

import GraphqlJSTransport from 'lokka-transport-graphql-js';
import schema from './path/to/my-schema'; // A valid instance of GraphQLSchema
const transport = new GraphqlJSTransport(schema);
transport.send(`
    {
      allFilms {
        films {
          title
        }
      }
    }
`).then(response => {
    console.log(JSON.stringify(response, null, 2));
});

Send context, rootValue, etc.

It's possible to send rootValue and context:

const transport = new GraphqlJSTransport(schema, { rootValue: myRootValue, context: myContext });

Error Handling

By default it will create and throw a new Error object using the first GraphQL error. Error handling can be customized with the handleErrors option. Check the default error handler in lib/index.js for an example.

Keywords

FAQs

Package last updated on 07 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc