add design
This commit is contained in:
parent
811ad934c0
commit
9ac9deaa8f
31
README.md
31
README.md
|
@ -1,2 +1,33 @@
|
|||
# http-gateway
|
||||
|
||||
a lib for create gateway between and other protocol
|
||||
|
||||
interface
|
||||
|
||||
- create 创建http服务器app
|
||||
- registryHandlerFactory 注册protocol处理器工厂
|
||||
- app.registryPath
|
||||
|
||||
## HandlerFactory
|
||||
|
||||
一个函数或者拥有静态createHandler方法的class
|
||||
|
||||
工厂函数/createHandler方法签名
|
||||
|
||||
```typescript
|
||||
interface HandlerFn {
|
||||
(options: any): (req:Request,resp: Response)=>void
|
||||
}
|
||||
|
||||
interface HandlerClass {
|
||||
createHandler: HandlerFn
|
||||
}
|
||||
|
||||
type HandlerFactory = HandlerFn | HandlerClass
|
||||
```
|
||||
|
||||
## registryHandlerFactory
|
||||
|
||||
```typescript
|
||||
registryHandlerFactory(type:string, HandlerFactory)
|
||||
```
|
|
@ -0,0 +1,9 @@
|
|||
interface HandlerFn {
|
||||
(options: any): (req:Request,resp: Response)=>void
|
||||
}
|
||||
|
||||
interface HandlerClass {
|
||||
createHandler: HandlerFn
|
||||
}
|
||||
|
||||
type HandlerFactory = HandlerFn | HandlerClass
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "http-gateway",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "ssh://git@git.pyer.club:2222/kingecg/http-gateway.git"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC"
|
||||
}
|
Loading…
Reference in New Issue