1.0.7 • Published 3 years ago

handle-mock v1.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

handleMock

An express middleWare function to control request forward,if the request match the config, it will return the mock data,otherwise the reauet will forward to the target host

handleMock(config:config[], defaultHost: string):void

usage:

const config = [
    {
      url: '/search_api/v1/search',
      params: {
      name: 'yyyy',
    },
    mockData: { m: 'mmm' },
    target: 'https://api.juejin.cn',
    },
]

app.use(handleMock(config, 'https://api.juejin.cn'));
1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago