wotschofsky / express-dnt

A simple middleware that adds a convenience property for the users Do-Not-Track preference.

Repository from Github https://github.comwotschofsky/express-dntRepository from Github https://github.comwotschofsky/express-dnt

npm

express-dnt

A simple middleware that adds a convenience property for the users Do-Not-Track preference.

Basic example

   const express = require('express')
   const expressDnt = require('express-dnt')

   const app = express()

   app.use(expressDnt())

   app.get('/', (req, res) => {
      res.end(`Do not track enabled: ${req.dnt}`)
      // req.dnt is either true or false
   })

Custom attribute name

   const express = require('express')
   const expressDnt = require('express-dnt')

   const app = express()

   app.use(expressDnt('doNotTrack')) // Pass a string with the custom property name

   app.get('/', (req, res) => {
      res.end(`Do not track enabled: ${req.doNotTrack}`)
   })

About

A simple middleware that adds a convenience property for the users Do-Not-Track preference.

License:MIT License


Languages

Language:TypeScript 100.0%