Treblle with SailsJS
To integrate Treblle with Sails, we provide an official SDK for Sails - treblle-sails
.
Installation
Setting up credentials
Treblle needs you to specify your project Id and API key. @treblle/sails
makes this easy to do by expecting you to set it up in config/local.js
as:
@treblle/sails
will also check your environment for the following environment variables:
TREBLLE_API_KEY
TREBLLE_PROJECT_ID
Config options
@treblle/sails
also checks config/treblle.js
for config options like apiKey
, projectId
, etc. So you can create a config/treblle.js
file in your project to look like this:
routesToMonitor
One config worthy of note is the routesToMonitor
array. By default, the routesToMonitor
array has the following routes:
The above tell the @treblle/sails
SDK to monitor all routes except asset routes(asset routes include routes to images, CSS stylesheets, etc)
You can override the routesToMonitor
array by passing the routes you want to monitor in config/treblle.js
.
For example if you want to monitor only /api/*
routes, you can pass the config like so: