1.0.0 • Published 5 months ago

tiny-log-http v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

tiny-log-http

Simple middleware for logging requests

npm i tiny-log-http

Usage

const express = require('express')
const logHTTP = require('tiny-log-http')

const app = express()

app.use(logHTTP())

app.get('/', function (req, res) {
  res.json('Hello World!')
})

app.listen(3000)

API

const middleware = logHTTP([options])

Available options:

{
  enable: true,
  trustProxy: false, // Uses 'x-forwarded-for' header for the IP
  cloudflare: false, // Uses 'cf-ipcountry' header for the country
  ignoreIPs: [],
  ignoreURLs: [],
  headers: false,
  body: false,
  userAgent: true
}

License

MIT