This template uses Edge Config as fast storage to control whether an 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:
After setting up your environment variables, deploy the example using Vercel:
Execute create-next-app
with npm or Yarn to bootstrap the example:
Set up environment variablesnpx create-next-app --example https://github.com/vercel/examples/tree/main/edge-middleware/feature-flag-apple-store # or yarn 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:
npm install npm run dev # or yarn yarn 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
. Use API routes or Vercel's Edge Config UI to update Edge Config.
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 as 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 an 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:
After setting up your environment variables, deploy the example using Vercel:
Execute create-next-app
with npm or Yarn to bootstrap the example:
Set up environment variablesnpx create-next-app --example https://github.com/vercel/examples/tree/main/edge-middleware/feature-flag-apple-store # or yarn 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:
npm install npm run dev # or yarn yarn 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
. Use API routes or Vercel's Edge Config UI to update Edge Config.
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 as 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.