1.0.6 • Published 4 years ago

koa-reqlog v1.0.6

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

koa-reqlog

Build Status

Simple middleware for view logs in KoaJS@2.

Install

$ npm install koa-reqlog

Features

  • navigation
  • searchbar

Hello world

npm install koa 
npm install koa-json 
npm install koa-bodyparser 
npm install koa-reqlog

index.js:

const Koa = require('koa');
const koaJson = require('koa-json');
const koaBodyParser = require('koa-bodyparser');
const requestLogger = require('koa-reqlog');

const app = new Koa();

app.use(koaJson({ pretty: false }));
app.use(koaBodyParser({ enableTypes: ['json'] }));
app.use(requestLogger({ lastItems: 20, url: '/request-log' }));

app.listen(process.env.PORT || 3000);
$ node index.js
$ curl -i -XGET http://localhost:3000/?someparam=someValue
HTTP/1.1 404 Not Found
x-request-id: d6787c4b
Content-Type: text/plain; charset=utf-8
Content-Length: 9
Date: Fri, 09 Nov 2018 14:23:56 GMT
Connection: keep-alive

Not Found

Then open http://localhost:3000/request-log

See full example in examples

Options

Options available for koa-reqlog.

  • url {String} Url for preview request log in app, default /request-log
  • lastItems {Number} Count of latest request, default 20

Tests

$ npm test

License

The MIT License, 2018

1.0.6

4 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

6 years ago

1.0.0

6 years ago