mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
feat(onboarding): nodejs snippet for production (#8256)
This commit is contained in:
parent
44bf6615a3
commit
c7427f4b91
@ -141,6 +141,8 @@ export const TestSdkConnection: FC<ITestSdkConnectionProps> = ({
|
|||||||
.replace('<YOUR_API_TOKEN>', apiKey)
|
.replace('<YOUR_API_TOKEN>', apiKey)
|
||||||
.replace('<YOUR_API_URL>', apiUrl)
|
.replace('<YOUR_API_URL>', apiUrl)
|
||||||
.replaceAll('<YOUR_FLAG>', feature);
|
.replaceAll('<YOUR_FLAG>', feature);
|
||||||
|
const [connectSnippet, _productionSnippet, _otherResourcesSnippet] =
|
||||||
|
snippet.split('---\n');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SpacedContainer>
|
<SpacedContainer>
|
||||||
@ -164,7 +166,7 @@ export const TestSdkConnection: FC<ITestSdkConnectionProps> = ({
|
|||||||
</ChangeSdk>
|
</ChangeSdk>
|
||||||
<SectionHeader>Setup the SDK</SectionHeader>
|
<SectionHeader>Setup the SDK</SectionHeader>
|
||||||
<Markdown components={{ code: CodeRenderer }}>
|
<Markdown components={{ code: CodeRenderer }}>
|
||||||
{snippet}
|
{connectSnippet}
|
||||||
</Markdown>
|
</Markdown>
|
||||||
</Box>
|
</Box>
|
||||||
</SpacedContainer>
|
</SpacedContainer>
|
||||||
|
@ -21,3 +21,21 @@ setInterval(() => {
|
|||||||
console.log('Is enabled', unleash.isEnabled('<YOUR_FLAG>'));
|
console.log('Is enabled', unleash.isEnabled('<YOUR_FLAG>'));
|
||||||
}, 1000);
|
}, 1000);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
```js
|
||||||
|
const { UnleashClient } = require('unleash-proxy-client');
|
||||||
|
|
||||||
|
const unleash = new UnleashClient({
|
||||||
|
url: '<YOUR_API_URL>',
|
||||||
|
appName: 'unleash-onboarding-node',
|
||||||
|
customHeaders: { Authorization: process.env.UNLEASH_API_KEY },
|
||||||
|
});
|
||||||
|
|
||||||
|
unleash.start();
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
- [SDK repository with documentation](https://github.com/Unleash/unleash-client-node)
|
||||||
|
- [Node.js SDK example with CodeSandbox](https://github.com/Unleash/unleash-sdk-examples/tree/main/JavaScript)
|
||||||
|
- [Node.js SDK tutorial](https://dev.to/reeshee/how-to-implement-feature-flags-in-nodejs-using-unleash-3907)
|
||||||
|
Loading…
Reference in New Issue
Block a user