http-gateway/README.md

604 B

http-gateway

a lib for create gateway between and other protocol

interface

  • create 创建http服务器app
  • registryHandlerFactory 注册protocol处理器工厂
  • app.registryPath

HandlerFactory

一个函数或者拥有静态createHandler方法的class

工厂函数/createHandler方法签名

interface HandlerFn {
    (options: any): (req:Request,resp: Response)=>void
}

interface HandlerClass {
    createHandler: HandlerFn
}

type HandlerFactory = HandlerFn | HandlerClass

registryHandlerFactory

registryHandlerFactory(type:string, HandlerFactory)