express-dnt
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.1 • Public • Published

    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}`)
       })

    Install

    npm i express-dnt

    DownloadsWeekly Downloads

    2

    Version

    2.0.1

    License

    MIT

    Unpacked Size

    6.01 kB

    Total Files

    7

    Last publish

    Collaborators

    • feliskio