This quickstart will show you how to get started with Edge Flags in a Next.js project.
Go to console.upstash.com/redis and create a new global database.
After creating the db, copy the UPSTASH_REDIS_REST_URL
and
UPSTASH_REDIS_REST_TOKEN
to your .env
file.
Go to console.upstash.com/edge-flags and select the database you created in the previous step. Create a new flag and enable it. Then you can add some rules.
In this case, the flag has a percentage and 2 rules. For 80% of the users the
flag will be evaluated. For the other 20% the flag will immediately return
false
without evaluating the rules.
userId
set to chronark
.Rules are evaluated from top to bottom. If a rule matches, the flag will return the configured value and stop evaluating the remaining rules.
If neither rule matches, the flag will return false
Make sure you have enabled the flag by clicking on the toggle button in the top right corner.
Now lets use the flag in our Next.js project.
For more information about client side usage, see here.
This quickstart will show you how to get started with Edge Flags in a Next.js project.
Go to console.upstash.com/redis and create a new global database.
After creating the db, copy the UPSTASH_REDIS_REST_URL
and
UPSTASH_REDIS_REST_TOKEN
to your .env
file.
Go to console.upstash.com/edge-flags and select the database you created in the previous step. Create a new flag and enable it. Then you can add some rules.
In this case, the flag has a percentage and 2 rules. For 80% of the users the
flag will be evaluated. For the other 20% the flag will immediately return
false
without evaluating the rules.
userId
set to chronark
.Rules are evaluated from top to bottom. If a rule matches, the flag will return the configured value and stop evaluating the remaining rules.
If neither rule matches, the flag will return false
Make sure you have enabled the flag by clicking on the toggle button in the top right corner.
Now lets use the flag in our Next.js project.
For more information about client side usage, see here.