breeze-web
介绍
第一版基于Koa构建web能力,该中间件包含了缓存,权限验证,参数序列化等插件
快速开始
npm install breeze-web
中间件启动事例
DefaultConfig.middlewares.push({
name : "web" ,
require : Web ,
desc : "web服务" ,
port : 9001 ,
actionPath : __dirname + "/action" ,
handler : [
{ name : "错误统一处理插件" , entity : ErrorHandler } ,
{ name : "权限验证处理插件" , entity : AuthHandler } ,
{ name : "请求统一处理插件" , entity : PackageHandler } ,
]
})
Action代码片段:
const { BaseAction , RequestParser , RequestAuth } = require("breeze-web")
const IndexAction = new BaseAction("test")
const ParamOption = RequestParser.ParamOption
IndexAction.get({
path : "/ok"
} , async ctx => {
ctx.body = "run ok."
})
module.exports = IndexAction
其中handler部分为web插件,独立存在,更多的使用参考 breeze-example