Skip to content

Latest commit

History

History
43 lines (28 loc) 路 782 Bytes

README.md

File metadata and controls

43 lines (28 loc) 路 782 Bytes

GraphQL Rate Limit - User Context

This example illustrates isolating operations between users. Commonly used in a multi user environment.

Overview

Specify a keyGenerator function which uses contextual information from the resolver's context.

In this example, a user is identified by the IP address of the request.

Setup

Step 1: Install requirements

yarn install

Run

Step 1: Start server

node index.js

Step 2: Open GraphiQL

Navigate to http://localhost:4000/graphql in a browser.

Step 3: Execute GraphQL operations

Server is configured to allow each root field to be queried once every 15 seconds. Sample query:

{
  quote
  books {
    title
    author
  }
}