1.0.0 • Published 5 years ago

@nioh/trace v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

中间件: 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