How to use koa-body.ck:
GitHub: SvenShi/sven_ninja
60 61 62 63 64 65 66 67 68 69 70 71
router.post('/api/update', body(), async (ctx) => { const body = ctx.request.body; const eid = body.eid; const username = body.username; const ck = body.ck; ctx.body = await new User({eid, ck, username}).update(); }); router.post('/api/disable', body(), async (ctx) => {
11
15
0
See more examples
How to use koa-body.username:
GitHub: SvenShi/sven_ninja
59 60 61 62 63 64 65 66 67 68 69
}); router.post('/api/update', body(), async (ctx) => { const body = ctx.request.body; const eid = body.eid; const username = body.username; const ck = body.ck; ctx.body = await new User({eid, ck, username}).update(); });
11
15
0
See more examples
How to use koa-body.token:
GitHub: SvenShi/sven_ninja
79 80 81 82 83 84 85 86 87 88 89 90
ctx.body = await new User({eid}).enableEnv(); }); router.post('/api/verifyToken', body(), async (ctx) => { const body = ctx.request.body; const token = body.token; ctx.body = await new User({token}).verifyToken(); });
11
15
0
See more examples
How to use koa-body.koaBody:
GitHub: koajs/koa-body
77 78 79 80 81 82 83 84 85 86
const Koa = require('koa'); const app = new Koa(); const router = require('koa-router')(); const { koaBody } = require('koa-body'); router.post('/users', koaBody(), (ctx) => { console.log(ctx.request.body); // => POST body ctx.body = JSON.stringify(ctx.request.body); });
129
910
15
See more examples
How to use koa-body.wseid:
GitHub: GATING/ninja
133 134 135 136 137 138 139 140 141 142 143
ctx.body = { data }; }); router.post("/api/WSCKDelaccount", body(), async (ctx) => { const body = ctx.request.body; const wseid = body.wseid; const user = new User({ wseid }); const data = await user.delWSCKUserByEid(); ctx.body = { data }; });
How to use koa-body.remark:
GitHub: GATING/ninja
96 97 98 99 100 101 102 103 104 105 106
}); router.post("/api/update/remark", body(), async (ctx) => { const body = ctx.request.body; const eid = body.eid; const remark = body.remark; const user = new User({ eid, remark }); const data = await user.updateRemark(); ctx.body = { data }; });
How to use koa-body.eid:
GitHub: SvenShi/sven_ninja
58 59 60 61 62 63 64 65 66 67 68
ctx.body = await new User({eid: ctx.request.body.eid}).delUserByEid(); }); router.post('/api/update', body(), async (ctx) => { const body = ctx.request.body; const eid = body.eid; const username = body.username; const ck = body.ck; ctx.body = await new User({eid, ck, username}).update(); });
11
15
0
See more examples