KOA相关笔记
全局安装
npm i koa-generator -g
创建项目
koa koa_demo
重要包
koa-router
koa-bodyparser
koa-jwt
1 | // hello world |
应用级中间件
app.
next
1 | //next匹配到路由以后继续向下 |
路由级中间件
1 | //引入和实例化路由 |
1 |
|
KOA中间件执行流程
洋葱
错误处理中间件
1 | app.use(async(ctx,next)=>{ |
第三方中间件
1 | //koa-static |
模板
ejs
art-template
cookie session
1 | ctx.cookies.set('token','123',{ |