Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dawkaka committed Oct 29, 2024
1 parent 87766c0 commit fc2e264
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ app.get('/hello/:name', (req, res) => {
res.json({ message: `Hello ${req.params.name}!` });
});

// comes after all other route handlers
app.use(expressErrorHandler);

app.listen(3000, () => {
Expand All @@ -41,9 +42,20 @@ where `<API-KEY>` is the API key which can be generated from your [apitoolkit.io

#### Quick overview of the configuration parameters

In the configuration above, **only the `serviceName` field required**, but you can add the following optional fields:

{class="docs-table"} ::: | Option | Description | | ------ | ----------- | | `debug` | Set to `true` to enable debug mode. | | `tags` | A list of defined tags for your services (used for grouping and filtering data on the dashboard). | | `serviceVersion` | A defined string version of your application (used for further debugging on the dashboard). | | `redactHeaders` | A list of HTTP header keys to redact. | | `redactResponseBody` | A list of JSONPaths from the response body to redact. | | `redactRequestBody` | A list of JSONPaths from the request body to redact. | | `captureRequestBody` | default `false`, set to true if you want to capture the request body. | | `captureResponseBody` | default `false`, set to true if you want to capture the response body. | :::
An object with the following optional fields can be passed to the middleware to configure it:

{class="docs-table"} :::
| Option | Description | | ------ | ----------- |
| `debug` | Set to `true` to enable debug mode. |
| `serviceName` | A defined string name of your application.|
| `tags` | A list of defined tags for your services (used for grouping and filtering data on the dashboard). |
| `serviceVersion` | A defined string version of your application (used for further debugging on the dashboard). |
| `redactHeaders` | A list of HTTP header keys to redact. |
| `redactResponseBody` | A list of JSONPaths from the response body to redact. |
| `redactRequestBody` | A list of JSONPaths from the request body to redact. |
| `captureRequestBody` | default `false`, set to true if you want to capture the request body. |
| `captureResponseBody` | default `false`, set to true if you want to capture the response body. |
:::

<br />

Expand Down
1 change: 0 additions & 1 deletion lib/apitoolkit.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ function expressMiddleware(config) {
res.send = val => {
if (config.captureResponseBody) {
respBody = val;
console.log('APIToolkit: respBodyv >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>', respBody);
}
return oldSend.apply(res, [val]);
};
Expand Down

0 comments on commit fc2e264

Please sign in to comment.