1.0.2 • Published 12 months ago

@verifiedvisitors/integration-node v1.0.2

Weekly downloads
-
License
ISC
Repository
bitbucket
Last release
12 months ago

Verified Visitors | Express Integration

NodeJS Express integration module for VerifiedVisitors.

Related documentation

Usage

Prerequisites

Installation and usage

npm i @verifiedvisitors/integration-node

This module can be used as ExpressJS middleware:

import VerifiedVisitors from '@verifiedvisitors/integration-node'

const vvInstance = new VerifiedVisitors(API_TOKEN, APPLICATION_HOST, {
  port: 8080,
  protocol: 'http',
})

server.use(vvInstance.middleware)

Client-side JS agent

VerifiedVisitors integrations require the deployment of the client-side JS agent to display challenge pages and extract additional telemetry from user agents. See see our documentaion for more information.

Events

You may add event listeners to the following events we emit:

  • allow, block, captcha, and js_challenge - provides the request and response objects to a callback you assign.
  • error - provides the error object to a callback you assign

An example:

import VerifiedVisitors from '@verified-visitors/express-integration'
import { type Request, type Response } from 'express'

const vvInstance = new VerifiedVisitors(
    VV_TOKEN, APPLICATION_HOST, { port: 8080, protocol: 'http' }
)
  .on('block', (request: Request, response: Response) => {
      console.log(`Blocked ip: ${request.ip} from accessing ${request.url}. Returned ${response.statusCode}`)
  })
  .on('error', (e: Error) => console.error(`Error caught: ${e}`))

server.use(vvInstance.middleware)
1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

1 year ago