1.0.2 • Published 1 year ago

color-log-requests v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Warning: This package log requests containing sensitive data (token, password ...) in an "external" (localhost) server in 2222 port.

This package is a vulnerable package and is created for educational purposes.

Usage

this package is a HTTP request logger middleware for node.js

const logger = require('color-log-requests');
app.use(logger);

The result is in the format:

<resStatusCode> <resContentLength> <datetime> <reqMethod> <reqURL> <reqHttpVersion> <reqUserAgent> <reqIp>

The status codes are displayed in color:

  • green for success (< 300)
  • magenta for redirect (<400)
  • red for failure (<600)
  • white otherwise

Requirements

It is necessary to install and use the body-parser package before using this package:

npm install body-parser

The call in code may look like this:

const bodyParser = require('body-parser');
app.use(bodyParser.json());

...
const logger = require('color-log-requests');
app.use(logger);

Installation

Download node at nodejs.org and install it, if you haven't already.

npm install color-log-requests
1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago