This template uses Upstash (Edge Redis Database) as fast storage to control whether an 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-functions/feature-flag-apple-store # or yarn create next-app --example https://github.com/vercel/examples/tree/main/edge-functions/feature-flag-apple-store
Get your Upstash credentials from the Upstash's dashboard, then rename .env.example to .env.local:
cp .env.example .env.local
And update it with your Upstash credentials.
Next, run Next.js in development mode:
npm install npm run dev # or yarn yarn dev
Deploy it to the cloud with Vercel (Documentation).
We can use Upstash's REST API to update the kev/value store or use API routes.
To open the store go to:
http://localhost:3000/api/store/open
To close the store go to:
http://localhost:3000/api/store/close
For Upstash's REST API: Replace the URLs and Authorization tokens below with the values from your Upstash Redis instance.
Open
$ curl https://your-upstash-url.upstash.io/set/store-closed/false -H "Authorization: Bearer YOUR_TOKEN"
Closed
$ curl https://your-upstash-url.upstash.io/set/store-closed/true -H "Authorization: Bearer YOUR_TOKEN"
This template uses Upstash (Edge Redis Database) as fast storage to control whether an store is open or closed.
This template uses Upstash (Edge Redis Database) as fast storage to control whether an 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-functions/feature-flag-apple-store # or yarn create next-app --example https://github.com/vercel/examples/tree/main/edge-functions/feature-flag-apple-store
Get your Upstash credentials from the Upstash's dashboard, then rename .env.example to .env.local:
cp .env.example .env.local
And update it with your Upstash credentials.
Next, run Next.js in development mode:
npm install npm run dev # or yarn yarn dev
Deploy it to the cloud with Vercel (Documentation).
We can use Upstash's REST API to update the kev/value store or use API routes.
To open the store go to:
http://localhost:3000/api/store/open
To close the store go to:
http://localhost:3000/api/store/close
For Upstash's REST API: Replace the URLs and Authorization tokens below with the values from your Upstash Redis instance.
Open
$ curl https://your-upstash-url.upstash.io/set/store-closed/false -H "Authorization: Bearer YOUR_TOKEN"
Closed
$ curl https://your-upstash-url.upstash.io/set/store-closed/true -H "Authorization: Bearer YOUR_TOKEN"