Socket
Socket
Sign inDemoInstall

apollo-server-restify-persisted-queries

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    apollo-server-restify-persisted-queries

Tiny in-memory persisted queries middleware for apollo-server-restify


Version published
Weekly downloads
2
decreased by-75%
Maintainers
1
Install size
6.64 kB
Created
Weekly downloads
 

Readme

Source

Current Version NPM Minified size Github Code Size Downloads/Week Issues License Contributors

NPM

apollo-server-restify-persisted-queries

Tiny in-memory automatic persisted queries middleware for apollo-server-restify

Since 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

Keywords

FAQs

Last updated on 28 Oct 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