Skip to content

Commit 1265709

Browse files
authored
Update README.md
updated typeWeightsFromSchema to include buildSchema import and fount a typo
1 parent 879a4cb commit 1265709

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ query {
180180

181181
```javascript
182182
{
183-
graphglGate: {
183+
graphqlGate: {
184184
success: boolean, // true when successful
185185
tokens: number, // tokens available after request
186186
compexity: number, // complexity of the query
@@ -212,6 +212,7 @@ This package exposes 3 additional functionalities which comprise the internals o
212212
```ts
213213
import { typeWeightsFromSchema } from 'graphql-limiter';
214214
import { GraphQLSchema } from 'graphql/type/schema';
215+
import { buildSchema } from 'graphql';
215216

216217
let schema: GraphQLSchema = buildSchema(`...`);
217218

@@ -248,10 +249,10 @@ This package exposes 3 additional functionalities which comprise the internals o
248249
- `rateLimiter: RateLimiterConfig` | see "configuration" -> rateLimiter
249250
- `client: Redis` | an ioredis client
250251
- `keyExpiry: number` | time (ms) for key to persist in cache
251-
- returns a class with method:
252+
- returns a rate limiter class with method:
252253

253254
- `processRequest(uuid: string, timestamp: number, tokens = 1): Promise<RateLimiterResponse>`
254-
- returns: `{ success: boolean, tokens: number, retryAfter?: number }` | where tokens is tokens available, retryAfter is time to wait in seconds before the request would be successful and success is false if the request is blocked
255+
- returns: `{ success: boolean, tokens: number, retryAfter?: number }` | where `tokens` is tokens available, `retryAfter` is time to wait in seconds before the request would be successful and `success` is false if the request is blocked
255256

256257
```ts
257258
import { rateLimiter } from 'graphql-limiter';

0 commit comments

Comments
 (0)