diff --git a/packages/app/src/load.ts b/packages/app/src/load.ts index ac793ea..1c1ea1b 100644 --- a/packages/app/src/load.ts +++ b/packages/app/src/load.ts @@ -29,7 +29,7 @@ export async function loadBuildinMiddlewaire(rpc?) { } export async function loadMiddleware(rpc, lifeCycle, mw) { - console.dir(lifeCycle); - console.dir(mw); + log(lifeCycle); + log(mw); rpc.config.hooks[lifeCycle].push(mw); } diff --git a/packages/app/src/mw/jwt.ts b/packages/app/src/mw/jwt.ts index 4938989..0b883d3 100644 --- a/packages/app/src/mw/jwt.ts +++ b/packages/app/src/mw/jwt.ts @@ -1,7 +1,10 @@ +import koajwt from 'koa-jwt'; + export const jwt = { name: 'jwt', lifeCycle: 'load', - mw: async (ctx: any, next: any) => { - await next(); + mw: (opts) => { + // console.dir(opts); + return koajwt(opts); }, }; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index a28e271..317bf99 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -151,8 +151,6 @@ export const createServer = function (config?: any) { const key = ctx.path.replace('/', '').split('/').join('.'); _cfg.beforeOne(ctx, key); - console.dir(ctx.jwt); - const lastKey = key.split('.').pop(); const httpMethods = getHttpMethods();