0.8.0 • Published 5 years ago

relay-local-schema v0.8.0

Weekly downloads
895
License
CC0-1.0
Repository
github
Last release
5 years ago

Relay Local Schema Travis npm

Use Relay without a GraphQL server.

Codecov Discord

Usage

import { Environment } from 'react-relay';
import { Network } from 'relay-local-schema';

import schema from './data/schema';

const environment = new Environment({
  network: Network.create({ schema }),
  /* ... */
});

This will execute queries against the specified schema locally, rather than against a separate GraphQL server.

You can also specify a GraphQL.js rootValue or contextValue:

const environment = new Environment({
  network: Network.create({
    schema,
    rootValue: 'foo',
    contextValue: 'bar',
  }),
  /* ... */
});

For more control over the network layer, you can use createFetch to create just the fetch function.

import { Environment, Network } from 'react-relay';
import { createFetch } from 'relay-local-schema';

import schema from './data/schema';

const environment = new Environment({
  network: Network.create(createFetch({ schema })),
  /* ... */
});

Caveat

This is intended for exploratory work, integration tests, demos, and working with local data. This is not generally intended as a substitute for a remote GraphQL back end in production.

0.8.0

5 years ago

0.7.0

6 years ago

0.6.2

7 years ago

0.6.1

7 years ago

0.6.0

7 years ago

0.5.5

7 years ago

0.5.4

8 years ago

0.5.3

8 years ago

0.5.2

8 years ago

0.5.1

8 years ago

0.5.0

8 years ago

0.4.0

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

9 years ago

0.2.1

9 years ago

0.2.0

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago