Integration
Follow the steps as mentioned to integrate Woofer and get real-time insights into your system anytime, anywhere! Get notified of the dangers by linking your Slack channel and Email, so that no problems go unnoticed!
Follow the steps as mentioned to integrate Woofer and get real-time insights into your system anytime, anywhere! Get notified of the dangers by linking your Slack channel and Email, so that no problems go unnoticed!
npm i wooffer
or
yarn add wooffer
Example code:
const monitoring = required("wooffer");
wooffer.alert("EventName: Login \nUsername:John Doe");
token = "<Your Token>";
serviceToken = "<Your Service Token>";
If you don't have a token and serviceToken then go on https://app.wooffer.io and generate.
To monitor real-time request usage, add the code to the root files such as app.js or index.js. Just below, create the 'app' variable and make the necessary modifications.
const express = require("express");
const app = express();
app.use(wooffer.requestMonitoring);
const app = require("express");
const wooffer = require("wooffer");
wooffer.alert("EventName: Login \nUsername:Jhon Due");
const wooffer = require("wooffer");
wooffer.success("EventName: Login \nUsername:Jhon Due");
const wooffer = require("wooffer");
wooffer.fail("EventName: Login \nUsername:Jhon Due");
Integrating Wooffer for third-party API calls is straightforward. Just use wooffer.axios instead of axios. Here's a simple example.
const wooffer = require("wooffer");
const config = {
method: "post",
maxBodyLength: Infinity,
url: "https://countriesnow.space/api/v0.1/countries/population/cities",
headers: {
"Content-Type": "application/json",
},
data: {
city: "lagos",
},
};
const response = await wooffer.axios.request(config);
or
const wooffer = require("wooffer");
const response = await wooffer.axios.post(
`https://countriesnow.space/api/v0.1/countries/population/cities`,
{
city: "lagos",
}
);