This template uses Edge Config as fast storage to control whether a store is open or closed.
This template uses Edge Config as fast storage to control whether the store is open or closed.
https://edge-functions-feature-flag-apple-store.vercel.app/
You can choose from one of the following two methods to use this repository:
Deploy the example using Vercel:
Execute create-next-app
with pnpm to bootstrap the example:
Set up environment variables
pnpm create next-app --example https://github.com/vercel/examples/tree/main/edge-middleware/feature-flag-apple-store
Copy the .env.example
file in this directory to .env.local
(which will be ignored by Git):
cp .env.example .env.local
This example requires you to set up an Edge Config and store its connection string in the EDGE_CONFIG
environment variable.
Fill the Edge Config you create with this content:
{ "featureFlagsAppleStore_storeClosed": true }
Next, run Next.js in development mode:
pnpm dev
Deploy it to the cloud with Vercel (Documentation).
You can control whether the store is open or not by changing the value of featureFlagsAppleStore_storeClosed
using the Edge Config Dashboard.
Note that you need to provide your own
TEAM_ID_VERCEL
andAUTH_BEARER_TOKEN
environment variables in.env.local
if you want to open or close the store using the routes shown below.
To open the store go to:
http://localhost:3000/api/store/open
To close the store go to:
http://localhost:3000/api/store/close
Alternatively you can use the Edge Config UI in your Vercel dashboard to update the featureFlagsAppleStore_storeClosed
value directly.
This template uses Edge Config as fast storage to control whether a store is open or closed.
This template uses Edge Config as fast storage to control whether the store is open or closed.
https://edge-functions-feature-flag-apple-store.vercel.app/
You can choose from one of the following two methods to use this repository:
Deploy the example using Vercel:
Execute create-next-app
with pnpm to bootstrap the example:
Set up environment variables
pnpm create next-app --example https://github.com/vercel/examples/tree/main/edge-middleware/feature-flag-apple-store
Copy the .env.example
file in this directory to .env.local
(which will be ignored by Git):
cp .env.example .env.local
This example requires you to set up an Edge Config and store its connection string in the EDGE_CONFIG
environment variable.
Fill the Edge Config you create with this content:
{ "featureFlagsAppleStore_storeClosed": true }
Next, run Next.js in development mode:
pnpm dev
Deploy it to the cloud with Vercel (Documentation).
You can control whether the store is open or not by changing the value of featureFlagsAppleStore_storeClosed
using the Edge Config Dashboard.
Note that you need to provide your own
TEAM_ID_VERCEL
andAUTH_BEARER_TOKEN
environment variables in.env.local
if you want to open or close the store using the routes shown below.
To open the store go to:
http://localhost:3000/api/store/open
To close the store go to:
http://localhost:3000/api/store/close
Alternatively you can use the Edge Config UI in your Vercel dashboard to update the featureFlagsAppleStore_storeClosed
value directly.