0.7.5 • Published 2 months ago

@blued-core/http-server v0.7.5

Weekly downloads
1
License
ISC
Repository
-
Last release
2 months ago

基于 routing-controller 的简易封装,抽出了一些复用的逻辑。

npx install-peerdeps @blued-core/http-server

使用方式

import { createServer } from '@blued-core/http-server'

createServer({
  logPath: './log',
  exceptionReportUrl: 'sentry.xxx.com',
  performanceConfig: {
    host: '0.0.0.1',
    port: 12345,
    group: 'test',
    project: 'test-project'
  },
  port: 1234
})

// 具体的 router 实现

import { JsonController, Get } from '@blued-core/http-server'

@JsonController('/test')
export default class {
  @Get('/patha')
  get () {
    return 'Hello World'
  }
}

// curl http://127.0.0.1:1234/test/patha

如果请求 Header 携带 Content-Type: application/json 则会主动拼接参数,类似
{ code: 200, data: 'Hello World' }

主要文档基于:http-server-base

额外提供的参数

optiontypedefaultdesc
logPathstring-设置 log 输出的路径
exceptionReportUrlstring-设置异常监控上报的路径
performanceConfigObject-设置性能监控上报的配置

performanceConfig 具体配置

optiontypedesc
hoststring配置的 IP
portnumber端口号
groupstring上报数据所属分组
projectstring上报数据所属项目
0.7.5

2 months ago

0.7.4

3 months ago

0.7.2

3 months ago

0.7.3

3 months ago

0.7.1

3 months ago

0.7.0

1 year ago

0.6.0

3 years ago

0.5.2

3 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.4.0

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago