Skip to content

Commit

Permalink
docs(chore): indent code block properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasheartman committed Jan 3, 2022
1 parent 8ae2de8 commit bdbd659
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions website/docs/how-to/how-to-use-custom-strategies.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,32 +162,32 @@ The Unleash Proxy accepts a `customStrategies` property as part of its initializ

3. **Pass the strategy to the Proxy Client** using the **`customStrategies`** option. A full code example:

``` javascript
const { createApp } = require('@unleash/proxy');
const { Strategy } = require('unleash-client');

class TimeStampStrategy extends Strategy {
constructor() {
super('TimeStamp');
}

isEnabled(parameters, context) {
return Date.parse(parameters.enableAfter) > Date.now();
}
}

const port = 3000;

const app = createApp({
unleashUrl: 'https://app.unleash-hosted.com/demo/api/',
unleashApiToken: '*:default.56907a2fa53c1d16101d509a10b78e36190b0f918d9f122d',
proxySecrets: ['proxy-secret', 'another-proxy-secret', 's1'],
refreshInterval: 1000,
customStrategies: [new TimeStampStrategy()]
});

app.listen(port, () =>
// eslint-disable-next-line no-console
console.log(`Unleash Proxy listening on http://localhost:${port}/proxy`),
);
```
``` javascript
const { createApp } = require('@unleash/proxy');
const { Strategy } = require('unleash-client');

class TimeStampStrategy extends Strategy {
constructor() {
super('TimeStamp');
}

isEnabled(parameters, context) {
return Date.parse(parameters.enableAfter) > Date.now();
}
}

const port = 3000;

const app = createApp({
unleashUrl: 'https://app.unleash-hosted.com/demo/api/',
unleashApiToken: '*:default.56907a2fa53c1d16101d509a10b78e36190b0f918d9f122d',
proxySecrets: ['proxy-secret', 'another-proxy-secret', 's1'],
refreshInterval: 1000,
customStrategies: [new TimeStampStrategy()]
});

app.listen(port, () =>
// eslint-disable-next-line no-console
console.log(`Unleash Proxy listening on http://localhost:${port}/proxy`),
);
```

0 comments on commit bdbd659

Please sign in to comment.