Skip to content

Delta compression over HTTP with extended support for GraphQL

Notifications You must be signed in to change notification settings

wmsmacdonald/deltaflate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 

Repository files navigation

deltaflate

Delta compression over HTTP with extended support for GraphQL (WIP)

Apollo client

import { createFetch } from 'deltaflate-decode-graphql';
import jsondiffpatchImDecoder from 'deltaflate-decode/jsondiffpatchImDecoder';
import hash from 'object-hash';

import { HttpLink } from 'apollo-link-http';
import { InMemoryCache } from 'apollo-cache-inmemory';

const cache = new InMemoryCache();

const detlaflateFetch = createFetch(cache, [jsondiffpatchImDecoder], hash, window.fetch);

const link = new HttpLink({ uri: 'http://api.githunt.com/graphql', fetch: detlaflateFetch });

const client = new ApolloClient({
  link,
  cache
});

Express GraphQL server

const { deltaflateExpress } = require('deltaflate-express');
const { GraphQLEncoderDictionaryStore } = require('deltaflate-decode-graphql');

const express = require('express');
const { graphqlExpress } = require('apollo-server-express');
const express = require('express');
const { InMemoryCache } = require('apollo-cache-inmemory');

const app = express();

const dictionaryStore = new GraphQLEncoderDictionaryStore(() => new InMemoryCache());

app.use('/graphql', deltaflateExpress(dictionaryStore), graphqlExpress({ schema }));

About

Delta compression over HTTP with extended support for GraphQL

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published