Skip to content

manju4ever/fastify-impressions

Repository files navigation

fastify-impressions

npm version fastify-impressions Known Vulnerabilities

Plugin to track impressions based on route(s)

Install

npm i fastify-impressions

Usage

const fastify = require("fastify")({ logging: false });
const fastifyImpressions = require("fastify-impressions");

fastify
  .register("fastifyImpressions", {
    blacklist: [], // specify URL's that are not to be tracked
    trackSuccessOnly: false // track only success responses
  })
  .catch(console.error);

fastify.listen(8080, (err, address) => {
  console.debug("Server started at:", address);
});

To see the impressions of the respective routes, access the /fastify-impressions, and this should return a JSON response

Plugin Options

  • blacklist <Array>
    • A list of URL's that should not be tracked
  • trackSuccessOnly <Boolean>
    • Enable this flag to track success responses only (200 series)

License

Licensed under ISC

About

A fastify plugin to track impressions on routes

Resources

License

Stars

Watchers

Forks

Packages

No packages published