Node.js quickstart
1. Install hypertune
hypertune
Once you have a Node.js application ready, install Hypertune's JavaScript SDK:
2. Set environment variables
Define the following environment variables in your .env
file:
Replace token
with your main project token which you can find in the Settings tab of your project.
3. Generate the client
Generate a type-safe client to access your flags by running:
4. Use the client
Install the dotenv
package or ensure you have another way to load environment variables:
Add a new file called loadEnv.ts
that loads environment variables with dotenv
:
Add a new file called getHypertune.ts
that exports a getHypertune
function:
To access flags, use the getHypertune
function:
5. (Optional) Include a build-time logic snapshot
Add the following environment variable to your .env
file:
Then regenerate the client.
That's it
Now you can update the logic for exampleFlag
from the Hypertune UI without updating your code or waiting for a new build, deployment or service restart.
To add a new flag, create it in the Hypertune UI then regenerate the client.
Last updated