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! 

Setup

Installation

npm i wooffer

or

yarn add wooffer

 

How to use Wooffer

  • Add the below code into your root file like app.js or index.js

Example code:

const monitoring = required("wooffer");

wooffer.alert("EventName: Login \nUsername:John Doe");

  • Add the below code to your .env file:

token = "<Your Token>";

serviceToken = "<Your Service Token>";

Note:

If you don't have a token and serviceToken then go on https://app.wooffer.io and generate.

 

Monitor real-time request analytics!

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");

 

Create custom log

  • To create Create Custom Alert Message

const wooffer = require("wooffer");

wooffer.alert("EventName: Login \nUsername:Jhon Due");

  • To create Create Custom Success Message

const wooffer = require("wooffer");

wooffer.success("EventName: Login \nUsername:Jhon Due");

  • To create Create Custom Fail Message

const wooffer = require("wooffer");

wooffer.fail("EventName: Login \nUsername:Jhon Due");

 

Create third-party API Call

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",
 }
);