New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@blued-core/http-server

Package Overview
Dependencies
Maintainers
5
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blued-core/http-server

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

  • 0.7.5
  • latest
  • npm
  • Socket score

Version published
Maintainers
5
Created
Source

基于 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上报数据所属项目

FAQs

Package last updated on 27 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc