Hi,
I am playing with logging api calls using something called treblle.com (the client has seen this and wants it as it “looks cool”)
It sits at the server level rather than page or server connect and I have installed the npm but there is a little bit of code that needs to be added so it can capture API calls and the data.
If I add it to the server.js it all works fine but the code is sometimes removed from that file (I assume on updates or similar).
Where should I put it so it runs and collects API calls directly on the server?
Here is the code from their instructions:
// DON'T FORGET TO LOAD THE REQUIRED JS MODULES
const express = require("express");
const { useTreblle } = require("treblle");
const app = express();
app.use(express.json());
useTreblle(app, {
apiKey: "_YOUR_API_KEY_",
projectId: "_YOUR_PROJECT_ID_"
});
When I add it to the server.js I edit it to:
const { useTreblle } = require("treblle");
useTreblle(app, {
apiKey: "_YOUR_API_KEY_",
projectId: "_YOUR_PROJECT_ID_"
});
Where should this go if not in the server.js?
Thanks.
Community Page
Last updated:
Last updated: