mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Move custom properties into DefaultContext
This allows having a strict `Koa<{}, {}>`.
* Fix tests
9 lines
338 B
TypeScript
9 lines
338 B
TypeScript
import Koa = require('koa');
|
|
import koaLogger = require('koa-log');
|
|
|
|
koaLogger.morgan.token('request-ip', ctx => JSON.stringify(ctx.request.ip));
|
|
koaLogger.morgan.token('response-body', ctx => JSON.stringify(ctx.body));
|
|
|
|
const app = new Koa();
|
|
app.use(koaLogger(':status :method :url took :response-time ms :request-ip :response-body'));
|