You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.
typeQuery{
posts: [Post]! @rateLimit(window: "5s",// time interval window for request limit quotamax: 10,// maximum requests allowed in time windowmessage: "Too many calls!"// quota reached error message)
# unlimitedField: String}
Since our function is serverless, we need to keep in mind that using memory store is probably not the best idea. Instead, let's use Redis to manage our IP address logging. Create a redis entity:
// api/src/lib/redis.js// https://github.com/teamplanes/graphql-rate-limit#redis-store-usage// TODO
Lastly, add the plugin to the graphql server, and specify the store option to use our Redis instance:
@pi0neerpat Thanks for taking this on -- in fact after @dac09 and I implemented the Validator and Transformer directives, I realized that "traditional" directives might collide -- but then I realized, maybe not!
I hoped (but did not confirm) that since the directive in the schema -- which is declared by the plugin -- is neither a Validator or Transformer:
Howdy, I'm almost done implementing rate limiting using the envelop plugin. Wanted to start throwing together docs for this so others can use them.
Todo:
Docs for using @envelop/rate-limiter
First install the necessary packages:
Generate the
rateLimit
directive, and choose "Validator" when prompted:We'll need to make a few changes to the directive, so it can accept arguments:
Then add the directive to your SDLs e.g.:
Since our function is serverless, we need to keep in mind that using memory store is probably not the best idea. Instead, let's use Redis to manage our IP address logging. Create a redis entity:
Lastly, add the plugin to the graphql server, and specify the
store
option to use our Redis instance:The text was updated successfully, but these errors were encountered: