1.1.4 • Published 4 years ago

paceguard v1.1.4

Weekly downloads
288
License
ISC
Repository
github
Last release
4 years ago

PaceGuard Node.js Module

This is the paceguard Node.js module.

Visit paceguard.io for more details.

Get started

You can integrate paceguard within seconds into your node js / express environment. Currently we only support express integrations.

const {PaceGuard} = require('paceguard');
const pg = new PaceGuard({ 
  apikey : 'Your API Key',
});  
//This integration depends on your server. Tested with express
app.use(pg.mw());    

Patrol

You can easily integrate paceguard Patrol callbacks:

pg.on('patrol', (task) => {    
  console.log(`Patroltask incoming with taskid ${task.taskid}`);
  switch(task.function){ 
    case 'taskname': 
      //Call your task function that maps to the function name here
      yourfunction();
      break;  
    default: 
      break; 
  }
});   

Events

Various events are supported:

pg.on('error', (err) => {
  console.error(err);
})

pg.on('connected', () => { 
  console.log("PaceGuard is connected.");
});   

pg.on('disconnected', () => { 
  console.log("PaceGuard is disconnected");
})

Explore Architecture

The explore architecture feature is still an alpha release and allows paceguard to understand your routing. This is currently only supported for express applications.

Just add the following right before you boot your sever and after your routes are established:

pg.explore(app); 

Config

A variety of configurations are constantly being added to PG:

const pg = new PaceGuard({ 
  apikey : 'XXX',
  baseurl: "https://paceguardonpremise.companyname.com/api/v1/client/", 
  heartbeatintervalseconds: 10, 
  debug: false, 
  patrol: { 
      autoack : true
  }
}); ```
1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago