Skip to content

Commit 0141081

Browse files
committed
feat: add init with ctx.jwt
1 parent 8daa498 commit 0141081

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

packages/app/src/load.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export async function loadBuildinMiddlewaire(rpc?) {
2929
}
3030

3131
export async function loadMiddleware(rpc, lifeCycle, mw) {
32-
console.dir(lifeCycle);
33-
console.dir(mw);
32+
log(lifeCycle);
33+
log(mw);
3434
rpc.config.hooks[lifeCycle].push(mw);
3535
}

packages/app/src/mw/jwt.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
import koajwt from 'koa-jwt';
2+
13
export const jwt = {
24
name: 'jwt',
35
lifeCycle: 'load',
4-
mw: async (ctx: any, next: any) => {
5-
await next();
6+
mw: (opts) => {
7+
// console.dir(opts);
8+
return koajwt(opts);
69
},
710
};

packages/core/src/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ export const createServer = function (config?: any) {
151151
const key = ctx.path.replace('/', '').split('/').join('.');
152152
_cfg.beforeOne(ctx, key);
153153

154-
console.dir(ctx.jwt);
155-
156154
const lastKey = key.split('.').pop();
157155
const httpMethods = getHttpMethods();
158156

0 commit comments

Comments
 (0)