Socket
Socket
Sign inDemoInstall

lokka-transport-http-isomorphic

Package Overview
Dependencies
13
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    lokka-transport-http-isomorphic

Isomorphic HTTP Transport for Lokka


Version published
Weekly downloads
1
Maintainers
1
Install size
2.93 MB
Created
Weekly downloads
 

Changelog

Source

v1.6.2

25 February 2018 Drop node-fetch and use isomorphic-fetch.

Fixes #18. That causes due to a typo came with v1.6.0.

Readme

Source

lokka-transport-http-isomorphic

Isomorphic HTTP Transport Layer for Lokka

Drop node 0.10 support

remove node-fetch as it cause webpack warning, and use isomorphic-fetch.


This is a graphql-express compatible transport layer for Lokka.

Basic Usage

Install the package:

npm i --save lokka-transport-http-isomorphic
npm i --save lokka

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

import HttpTransport from 'lokka-transport-http';
const transport = new HttpTransport('http://graphql-swapi.parseapp.com/');
transport.send(`
    {
      allFilms {
        films {
          title
        }
      }
    }
`).then(response => {
    console.log(JSON.stringify(response, null, 2));
});

Send Custom Headers

It's possible to send custom headers like this:

const headers = {
    'my-headers': 'some-value'
};
const transport = new HttpTransport('/graphql', {headers});

Authentication

This package does not handle authentication information for you. But it'll let you interact with your app's existing authentication mechanism.

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 deafult error handler in lib/index.js for an example.

Keywords

FAQs

Last updated on 25 Feb 2018

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc