diff --git a/packages/core2/demo.ts b/packages/core2/demo.ts index 79cec74..9af3bba 100644 --- a/packages/core2/demo.ts +++ b/packages/core2/demo.ts @@ -1,4 +1,4 @@ -import Plugable from './src/base'; +import { Plugable } from './src/base'; export default class Fn extends Plugable { // public name: string; diff --git a/packages/core2/src/base.ts b/packages/core2/src/base.ts index f375348..ea1f332 100644 --- a/packages/core2/src/base.ts +++ b/packages/core2/src/base.ts @@ -21,7 +21,7 @@ export interface Strategy { serverConfig; } -export default class Plugable implements Strategy { +export class Plugable implements Strategy { public init: any[] = []; public load: any[] = []; public name; diff --git a/packages/core2/src/fn.ts b/packages/core2/src/fn.ts index ce0b55f..fe797ac 100644 --- a/packages/core2/src/fn.ts +++ b/packages/core2/src/fn.ts @@ -1,6 +1,6 @@ import debug from 'debug'; -import Plugable from './base'; +import { Plugable } from './base'; import { isArrowFunction, getHttpMethods } from './utils'; const log = debug('@tomrpc/core'); @@ -94,8 +94,10 @@ export class Fn extends Plugable { // console.log(supportMethods); if (supportMethods.length === 0) { - console.log(ctx.path + ',没有匹配到包含get/post等开头的函数'); - await next(); + if (ctx.path.indexOf(this.prefix) != -1) { + console.log(ctx.path + ',没有匹配到包含get/post等开头的函数'); + await next(); + } } else if (ctx.method === supportMethods[0]) { log('匹配到包含get/post等方法的函数'); await next();