Showing
2 changed files
with
34 additions
and
0 deletions
@@ -109,6 +109,23 @@ module.exports = function (apiCofig) { | @@ -109,6 +109,23 @@ module.exports = function (apiCofig) { | ||
109 | ROU[router.method].apply(ROU, args); | 109 | ROU[router.method].apply(ROU, args); |
110 | }); | 110 | }); |
111 | 111 | ||
112 | + /*路由重复校验*/ | ||
113 | + var checkUsedRouter={}; | ||
114 | + ContRegisters.routers.forEach(function (router) { | ||
115 | + if(checkUsedRouter.hasOwnProperty(router.url)){ | ||
116 | + console.info("检查下控制器是否重复"); | ||
117 | + console.log(router.url); | ||
118 | + }else{ | ||
119 | + checkUsedRouter[router.url]=true; | ||
120 | + } | ||
121 | + | ||
122 | + var ROU = Router.route([router.url]); | ||
123 | + var args = FilterRegisters.use(router.url, router.method). | ||
124 | + concat(KLH(ContRegisters, "emit", router.guid)); | ||
125 | + ROU[router.method].apply(ROU, args); | ||
126 | + }); | ||
127 | + checkUsedRouter=null; | ||
128 | + | ||
112 | App.use(apiCofig.baseUrl, Router); | 129 | App.use(apiCofig.baseUrl, Router); |
113 | 130 | ||
114 | App.use(function (req, res, next) { | 131 | App.use(function (req, res, next) { |
@@ -109,6 +109,23 @@ module.exports = function (apiCofig) { | @@ -109,6 +109,23 @@ module.exports = function (apiCofig) { | ||
109 | ROU[router.method].apply(ROU, args); | 109 | ROU[router.method].apply(ROU, args); |
110 | }); | 110 | }); |
111 | 111 | ||
112 | + /*路由重复校验*/ | ||
113 | + var checkUsedRouter={}; | ||
114 | + ContRegisters.routers.forEach(function (router) { | ||
115 | + if(checkUsedRouter.hasOwnProperty(router.url)){ | ||
116 | + console.info("检查下控制器是否重复"); | ||
117 | + console.log(router.url); | ||
118 | + }else{ | ||
119 | + checkUsedRouter[router.url]=true; | ||
120 | + } | ||
121 | + | ||
122 | + var ROU = Router.route([router.url]); | ||
123 | + var args = FilterRegisters.use(router.url, router.method). | ||
124 | + concat(KLH(ContRegisters, "emit", router.guid)); | ||
125 | + ROU[router.method].apply(ROU, args); | ||
126 | + }); | ||
127 | + checkUsedRouter=null; | ||
128 | + | ||
112 | App.use(apiCofig.baseUrl, Router); | 129 | App.use(apiCofig.baseUrl, Router); |
113 | 130 | ||
114 | App.use(function (req, res, next) { | 131 | App.use(function (req, res, next) { |
-
Please register or login to post a comment