Comparing version 3.0.0-beta.1 to 3.0.0-rc.0
@@ -8,3 +8,5 @@ "use strict"; | ||
const Ajv = require('ajv'); | ||
const ajv = new Ajv(); | ||
const ajv = new Ajv({ | ||
coerceTypes: true, | ||
}); | ||
function check(data) { | ||
@@ -11,0 +13,0 @@ return Object.prototype.toString.call(data) === '[object Object]' && Object.keys(data).length > 0; |
{ | ||
"name": "astroboy", | ||
"version": "3.0.0-beta.1", | ||
"version": "3.0.0-rc.0", | ||
"description": "Astroboy(阿童木)is a Nodejs SFB(Separation of Front and Back ends) framework, built on koa2.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,2 +11,3 @@ "use strict"; | ||
console.log('开始注册路由 ===>'); | ||
let counter = 0; | ||
app.routers.forEach((router) => { | ||
@@ -17,3 +18,7 @@ for (let i = 0; i < router.method.length; i++) { | ||
const path = router.path[j]; | ||
console.log(`注册路由:${method} ${path} ==> ${router.controllerName}:${router.controllerMethods.join(' > ')}`); | ||
const name = router.name || ''; | ||
const controllerName = router.controllerName; | ||
const controllerMethods = router.controllerMethods || []; | ||
counter++; | ||
console.log(`${name}:${method} ${path} ==> ${controllerName}:${controllerMethods.join(' > ')}`); | ||
koaRouter[method](router.name, path, async function (ctx, next) { | ||
@@ -69,3 +74,3 @@ if (router.compiledSchema.header) { | ||
}); | ||
console.log(`所有路由注册成功,共注册 ${app.routers.length} 个路由\n`); | ||
console.log(`所有路由注册成功,共注册 ${counter} 个路由\n`); | ||
let fn = compose([koaRouter.routes(), koaRouter.allowedMethods()]); | ||
@@ -72,0 +77,0 @@ fn._name = 'astroboy-router'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
154612
2878