beta-wooffer
v1.2.15
Published
Wooffer - Monitoring System
Downloads
13
Readme
Table of contents
- Installation
- How to use Wooffer
- Monitor Real-time request analytics
- Create custom log
- How to track third-party APIs
Installation
npm i wooffer
or
yarn add wooffer
How to use Wooffer
Add Below Code into your Root file Like App.js or Index.js
Example Code
const wooffer = require("wooffer");
wooffer(process.env.token, process.env.serviceToken);
Add Below Code into your .env File
token = "<Your Token>";
serviceToken = "<Your Service Token>";
Monitor Real-time request analytics
To monitor real-time request usage, add the code into 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);
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",
}
);