# lokka-transport-http

> Isomorphic HTTP Transport for Lokka

Latest version **1.6.1** (published 2016-10-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install lokka-transport-http
pnpm add lokka-transport-http
yarn add lokka-transport-http
bun add lokka-transport-http
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.6.1 |
| Published | 2016-10-31 |
| First published | 2015-12-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 41 |
| Maintainers | arunoda, mnmtanish |
| Keywords | lokka, transport, http |

## Links

- npm: https://www.npmjs.com/package/lokka-transport-http
- Repository: https://github.com/kadirahq/lokka-transport-http
- Homepage: https://github.com/kadirahq/lokka-transport-http#readme
- Issues: https://github.com/kadirahq/lokka-transport-http/issues
- npm.io page: https://npm.io/package/lokka-transport-http

## Dependencies (3)

- [node-fetch](https://npm.io/package/node-fetch.md) ^1.5.2
- [whatwg-fetch](https://npm.io/package/whatwg-fetch.md) ^1.0.0
- [babel-runtime](https://npm.io/package/babel-runtime.md) 6.x.x

## Recent versions

- 1.6.1 (latest) — 2016-10-31
- 1.6.0 — 2016-10-27
- 1.5.0 — 2016-10-21
- 1.4.1 — 2016-10-21
- 1.4.0 — 2016-05-20
- 1.3.2 — 2016-03-04
- 1.3.1 — 2016-03-04
- 1.3.0 — 2015-12-16
- 1.2.0 — 2015-12-15
- 1.1.1 — 2015-12-14
- 1.1.0 — 2015-12-14
- 1.0.1 — 2015-12-14
- 1.0.0 — 2015-12-14

## README

# lokka-transport-http

Isomorphic HTTP Transport Layer for [Lokka](https://github.com/kadirahq/lokka)

---

This is a [graphql-express](https://github.com/graphql/express-graphql) compatible transport layer for [Lokka](https://github.com/kadirahq/lokka).

## Basic Usage

Install the package:

```
npm i --save lokka-transport-http
npm i --save lokka
```

This is how to send request to Facebook's [SWAPI GraphQL Demo](http://graphql-swapi.parseapp.com/).

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

```js
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.

* If you already have an authorized cookie, it'll be sent with the HTTP request. (supports CORS)
* You can also set a custom `Authorization` [header]((https://www.npmjs.com/package/basic-auth-header) to implement [basic-auth](https://www.npmjs.com/package/basic-auth) support.

## 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.

---
_Source: https://npm.io/package/lokka-transport-http · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
