mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 02:44:55 +00:00
docs(api-ref): add request context documentation
This commit is contained in:
parent
a8a52a3fad
commit
1b64353fc4
@ -171,4 +171,14 @@ Module to schedule cron jobs for Strapi project. It is an instance of a custom C
|
||||
|
||||
The `strapi.telemetry` property provides access to the telemetry service instance. This service collects anonymous usage data about your Strapi application to help the Strapi team improve the product.
|
||||
|
||||
By default, the telemetry service is enabled, but you can disable it by setting the telemetryDisabled property to true in your application's package.json file, or by setting the `STRAPI_TELEMETRY_DISABLED` environment variable to true. You can also disable telemetry programmatically by setting the isDisabled property of the `strapi.telemetry` instance to true.
|
||||
By default, the telemetry service is enabled, but you can disable it by setting the telemetryDisabled property to true in your application's package.json file, or by setting the `STRAPI_TELEMETRY_DISABLED` environment variable to true. You can also disable telemetry programmatically by setting the isDisabled property of the `strapi.telemetry` instance to true.
|
||||
|
||||
### `strapi.requestContext`
|
||||
- <Type>Object</Type> - Context Storage
|
||||
- 'run(store, cb)': <Type>Function</Type>
|
||||
- 'store': <Type>Any</Type> - Value that should be retrieved
|
||||
- 'cb': <Type>Function</Type> - Callback
|
||||
- 'get()': <Type>Function</Type>
|
||||
|
||||
The request context stores the ctx object from KoaJS on each request. This allows users to have access to the context from anywhere through the Strapi instance.
|
||||
|
||||
|
||||
@ -109,27 +109,13 @@ class Strapi {
|
||||
// Instantiate the Koa app & the HTTP server
|
||||
this.server = createServer(this);
|
||||
|
||||
// Strapi utils instanciation
|
||||
// Strapi utils instantiation
|
||||
this.fs = createStrapiFs(this);
|
||||
|
||||
this.eventHub = createEventHub();
|
||||
|
||||
this.startupLogger = createStartupLogger(this);
|
||||
|
||||
this.log = createLogger(this.config.get('logger', {}));
|
||||
|
||||
this.cron = createCronService();
|
||||
|
||||
/**
|
||||
* Service used to send statistical data to Amplitude
|
||||
*/
|
||||
this.telemetry = createTelemetry(this);
|
||||
|
||||
// TODO put this in /docs/docs/API/Strapi
|
||||
/**
|
||||
* TODO ask JS | Alex
|
||||
* Wrapper around async_hooks AsyncLocalStorage
|
||||
*/
|
||||
this.requestContext = requestContext;
|
||||
|
||||
// TODO put this in /docs/docs/API/Strapi
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user