tiny-log-http

1.0.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i tiny-log-http

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

4.42 kB

Total Files

5

Last publish

Collaborators

  • lukks