@nioh/trace
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @nioh/trace

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

3.79 kB

Total Files

4

Last publish

Collaborators

  • roei