koa-reqlog

1.0.6 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i koa-reqlog

Weekly Downloads

1

Version

1.0.6

License

MIT

Unpacked Size

40.5 kB

Total Files

11

Last publish

Collaborators

  • asergey