Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.
/ express-dnt Public archive

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

License

Notifications You must be signed in to change notification settings

wotschofsky/express-dnt

Repository files navigation

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.

Resources

License

Stars

Watchers

Forks

Packages

No packages published