Skip to content

Latest commit

History

History

context

Folders and files

NameName
Last commit message
Last commit date

parent directory

..

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
  }
}