Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wjsc/apollo-server-restify-persisted-queries
Tiny in-memory persisted queries middleware for apollo-server-restify
https://github.com/wjsc/apollo-server-restify-persisted-queries
apollo apq automatic graphql graphql-server middeware persisted queries query restify server
Last synced: about 2 months ago
JSON representation
Tiny in-memory persisted queries middleware for apollo-server-restify
- Host: GitHub
- URL: https://github.com/wjsc/apollo-server-restify-persisted-queries
- Owner: wjsc
- License: mit
- Created: 2018-10-27T23:34:47.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-28T16:38:16.000Z (over 6 years ago)
- Last Synced: 2024-11-15T14:18:49.525Z (3 months ago)
- Topics: apollo, apq, automatic, graphql, graphql-server, middeware, persisted, queries, query, restify, server
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/apollo-server-restify-persisted-queries
- Size: 162 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![Current Version](https://img.shields.io/npm/v/apollo-server-restify-persisted-queries.svg)
![NPM Minified size](https://img.shields.io/bundlephobia/min/apollo-server-restify-persisted-queries.svg)
![Github Code Size](https://img.shields.io/github/languages/code-size/wjsc/apollo-server-restify-persisted-queries.svg)
![Downloads/Year](https://img.shields.io/npm/dy/apollo-server-restify-persisted-queries.svg)
![Issues](https://img.shields.io/github/issues/wjsc/apollo-server-restify-persisted-queries.svg)
![License](https://img.shields.io/github/license/wjsc/apollo-server-restify-persisted-queries.svg)
![Contributors](https://img.shields.io/github/contributors/wjsc/apollo-server-restify-persisted-queries.svg)[![NPM](https://nodei.co/npm/apollo-server-restify-persisted-queries.png)](https://nodei.co/npm/apollo-server-restify-persisted-queries)
# apollo-server-restify-persisted-queries
Tiny in-memory automatic persisted queries middleware for apollo-server-restifySince apollo-server-restify uses Apollo Server 1.x, it has not support for APQ.
Use this module to get server support.This package implements a circular buffer that persists the latest X queries in a in-memory Map.
## Usage
```
import restify from 'restify';
import { graphqlRestify } from 'apollo-server-restify';// 1. Import the module
import { persistedQueries } from 'apollo-server-restify-persisted-queries';// 2. Set the number of cached queries
const cacheLength = 10;const server = restify.createServer({
title: 'Apollo Server',
});
const graphQLOptions = { schema: myGraphQLSchema };
server.use(restify.plugins.bodyParser());
server.use(restify.plugins.queryParser());// 3. Call the persistedQueries method, ant it returns a Middleware
server.get('/graphql', persistedQueries(graphqlRestify(graphQLOptions)), cacheLength);
server.listen(3000, () => console.log(`Listening on port 3000`));
```## Official Docs
https://www.apollographql.com/docs/guides/performance.html#automatic-persisted-queries