Treblle with Express
To integrate Treblle with Express, we provide an official SDK for Express - treblle-express
.
Installation
Setting up credentials
@treblle/express
expects your Treblle API key and project ID to be set as environment varibles in a .env
file or in your production environment.
Below are the environment variable that will be checked by @treblle/express
TREBLLE_API_KEY
TREBLLE_PROJECT_ID
Setup middleware
@treblle/express
expose a treblle
function which returns a middlware, you can pass this function to app.use()
to register it a middleware.
Treblle will now now start monitoring requests on your Express server.
Config options
You can optionally pass a config option to the treblle
function.
The additionalFieldsToMask config option takes in an array of strings that matches properties in your response payload or header that you want to mask