mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
docs(chore): indent code block properly.
This commit is contained in:
parent
8ae2de8a3e
commit
bdbd659a71
@ -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:
|
3. **Pass the strategy to the Proxy Client** using the **`customStrategies`** option. A full code example:
|
||||||
|
|
||||||
``` javascript
|
``` javascript
|
||||||
const { createApp } = require('@unleash/proxy');
|
const { createApp } = require('@unleash/proxy');
|
||||||
const { Strategy } = require('unleash-client');
|
const { Strategy } = require('unleash-client');
|
||||||
|
|
||||||
class TimeStampStrategy extends Strategy {
|
class TimeStampStrategy extends Strategy {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('TimeStamp');
|
super('TimeStamp');
|
||||||
}
|
}
|
||||||
|
|
||||||
isEnabled(parameters, context) {
|
isEnabled(parameters, context) {
|
||||||
return Date.parse(parameters.enableAfter) > Date.now();
|
return Date.parse(parameters.enableAfter) > Date.now();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const port = 3000;
|
const port = 3000;
|
||||||
|
|
||||||
const app = createApp({
|
const app = createApp({
|
||||||
unleashUrl: 'https://app.unleash-hosted.com/demo/api/',
|
unleashUrl: 'https://app.unleash-hosted.com/demo/api/',
|
||||||
unleashApiToken: '*:default.56907a2fa53c1d16101d509a10b78e36190b0f918d9f122d',
|
unleashApiToken: '*:default.56907a2fa53c1d16101d509a10b78e36190b0f918d9f122d',
|
||||||
proxySecrets: ['proxy-secret', 'another-proxy-secret', 's1'],
|
proxySecrets: ['proxy-secret', 'another-proxy-secret', 's1'],
|
||||||
refreshInterval: 1000,
|
refreshInterval: 1000,
|
||||||
customStrategies: [new TimeStampStrategy()]
|
customStrategies: [new TimeStampStrategy()]
|
||||||
});
|
});
|
||||||
|
|
||||||
app.listen(port, () =>
|
app.listen(port, () =>
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(`Unleash Proxy listening on http://localhost:${port}/proxy`),
|
console.log(`Unleash Proxy listening on http://localhost:${port}/proxy`),
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user