Install with Express.js

If you want APImetrics to monitor API calls to a Node express.js server, use these steps to build the APImetrics adaptor into your application.


This adaptor is currently in beta. Please contact us at [email protected].

Our Observability Adapter for Express.js applications allows you to monitor your live API traffic from Express.js, without configuring API calls manually in the APImetrics platform. By deploying this adapter, APImetrics can read API calls that are coming from Express.js, and automatically build your API Inventory. Once integrated, you can compare your live API traffic against your OAS spec, and set up synthetic endpoint monitoring automatically.

Download the Express.js Adaptor

To download the Express APImetrics adaptor, use the following:

npm i darkspark-expressjs-plug

To download to a specific directory, follow the guide here. Otherwise, this will automatically download to the node-modules folder in your root directory.

Include the APImetrics Adaptor in Your Express.js Application Source

In the source file in which your express instance is created, require the downloaded adaptor:

const { darkspark, darksparkVerify } = require("darkspark-expressjs-plug");

The darkspark function should be called with your Express application as its first argument, and your APImetrics API key as its second argument. To create a new API Key for APImetrics by following the tutorial here and choosing Ingress as your Access Level. For example:

const app = express();
darkspark(app, "key_abcdef");

The darksparkVerify function should be included in the verify option on any body-parser middleware you have installed on your application. Depending on your setup, this may look like any of the following:

    verify: darksparkVerify,
    verify: darksparkVerify,
    verify: darksparkVerify,
    extended: true,
    verify: darksparkVerify,

This completes the setup. The next time you deploy your application, incoming API calls will be captured by the Inventory.

What’s Next

Add these new API calls to your Schedules & Workflows: