0.7.5 • Published 2 months ago
@blued-core/http-server v0.7.5
基于 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
额外提供的参数
option | type | default | desc |
---|---|---|---|
logPath | string | - | 设置 log 输出的路径 |
exceptionReportUrl | string | - | 设置异常监控上报的路径 |
performanceConfig | Object | - | 设置性能监控上报的配置 |
performanceConfig 具体配置
option | type | desc |
---|---|---|
host | string | 配置的 IP |
port | number | 端口号 |
group | string | 上报数据所属分组 |
project | string | 上报数据所属项目 |
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