Treblle with Koa
To integrate Treblle with Koa, we provide an official SDK for Koa - treblle-koa
.
Installation
Setting up credentials
@treblle/koa
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/koa
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 Koa 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