@nioh/trace
v1.0.0
Published
koa request id
Downloads
3
Readme
中间件: request-id
安装
Install with npm
npm i @server/request-id --registry=http://npm.zkh360.com
说明
生成请求UID,绑定到KOA上下文state中,日志使用
使用
import * as Koa from 'koa'
import * as requestId from '@server/request-id'
const app = new Koa()
app.use(requestId())
app.use(ctx => {
const id = ctx.state.requestId
ctx.body = {
id
}
})
app.listen(3000)
ChangeLog
Tests
npm test
License
2019@ZKH-FE