{"id":13476891,"url":"https://github.com/chenshenhai/koa2-note","last_synced_at":"2025-05-14T16:02:00.515Z","repository":{"id":43114070,"uuid":"82682940","full_name":"chenshenhai/koa2-note","owner":"chenshenhai","description":"《Koa2进阶学习笔记》已完结🎄🎄🎄","archived":false,"fork":false,"pushed_at":"2022-02-12T03:58:22.000Z","size":7877,"stargazers_count":5185,"open_issues_count":26,"forks_count":1284,"subscribers_count":179,"default_branch":"master","last_synced_at":"2025-04-12T01:53:06.301Z","etag":null,"topics":["course-notes","koa","koa2","koa2-course","koajs","nodejs"],"latest_commit_sha":null,"homepage":"https://chenshenhai.github.io/koa2-note","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chenshenhai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-21T13:29:08.000Z","updated_at":"2025-04-11T10:05:22.000Z","dependencies_parsed_at":"2022-08-12T10:20:39.364Z","dependency_job_id":null,"html_url":"https://github.com/chenshenhai/koa2-note","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenshenhai%2Fkoa2-note","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenshenhai%2Fkoa2-note/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenshenhai%2Fkoa2-note/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chenshenhai%2Fkoa2-note/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chenshenhai","download_url":"https://codeload.github.com/chenshenhai/koa2-note/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248505873,"owners_count":21115354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["course-notes","koa","koa2","koa2-course","koajs","nodejs"],"created_at":"2024-07-31T16:01:35.807Z","updated_at":"2025-04-12T01:53:11.603Z","avatar_url":"https://github.com/chenshenhai.png","language":null,"funding_links":[],"categories":["Others","Code"],"sub_categories":["library/repositories"],"readme":"# 《Koa2进阶学习笔记》已完结\n\n## 序言\n\n从2017年2月份开始写这本开源电子书，是为了记录自己的学习轨迹和分享技术心得，本开源书的Koa2的基础进阶教程已经完结，更多的Koa.js的高阶学习会在后续新开几本书进行探索。感谢这一年来所有读者的关注！O(∩_∩)O。\n\n本书为`Koa.js` 2.x 的入门书籍，如果想了解更多 `Koa.js` 的原理，可阅读 [《Koa.js 设计模式-学习笔记》](https://github.com/chenshenhai/koajs-design-note)\n\n更多前端技术学习可关注公众号 `大海码` `DeepSeaCode` \n\n\n\u003cimg src=\"https://user-images.githubusercontent.com/8216630/43264303-495bf52c-9118-11e8-85cd-4ec6fcc6d066.jpg\" width=\"160\" /\u003e\n\n\n![koa2-note](./note/images/koa2-note.png)\n\n\n## 关于作者\n\n- [关于作者(我)](https://chenshenhai.com)\n- 本书协议 MIT\n\n## 快速阅读地址\n\n- 个人博客站点阅读 [https://chenshenhai.com/koa2-note](https://chenshenhai.com/koa2-note)\n- Github Pages 阅读 [https://chenshenhai.github.io/koa2-note/](https://chenshenhai.github.io/koa2-note/)\n\n## 目录\n* [1. koa2开始]()\n    * [1.1 快速开始](https://github.com/ChenShenhai/koa2-note/blob/master/note/start/quick.md)\n    * [1.2 async/await使用](https://github.com/ChenShenhai/koa2-note/blob/master/note/start/async.md)\n    * [1.3 koa2简析结构](https://github.com/ChenShenhai/koa2-note/blob/master/note/start/info.md)\n    * [1.4 koa中间件开发与使用](https://github.com/ChenShenhai/koa2-note/blob/master/note/start/middleware.md)\n* [2. 路由]()\n    * [2.1 原生koa2实现路由](https://github.com/ChenShenhai/koa2-note/blob/master/note/route/simple.md)\n    * [2.2 koa-router中间件](https://github.com/ChenShenhai/koa2-note/blob/master/note/route/koa-router.md)\n* [3. 请求数据获取]()\n    * [3.1 GET请求数据获取](https://github.com/ChenShenhai/koa2-note/blob/master/note/request/get.md)\n    * [3.2 POST请求数据获取](https://github.com/ChenShenhai/koa2-note/blob/master/note/request/post.md)\n    * [3.3 koa-bodyparser中间件](https://github.com/ChenShenhai/koa2-note/blob/master/note/request/post-use-middleware.md)\n* [4. 静态资源加载]()\n    * [4.1 原生koa2实现静态资源服务器](https://github.com/ChenShenhai/koa2-note/blob/master/note/static/server.md)\n    * [4.2 koa-static中间件](https://github.com/ChenShenhai/koa2-note/blob/master/note/static/middleware.md)\n* [5. cookie/session]()\n    * [5.1 koa2使用cookie](https://github.com/ChenShenhai/koa2-note/blob/master/note/cookie/info.md)\n    * [5.2 koa2实现session](https://github.com/ChenShenhai/koa2-note/blob/master/note/session/info.md)\n* [6. 模板引擎]()\n    * [6.1 koa2加载模板引擎](https://github.com/ChenShenhai/koa2-note/blob/master/note/template/add.md)\n    * [6.2 ejs模板引擎](https://github.com/ChenShenhai/koa2-note/blob/master/note/template/ejs.md)\n* [7. 文件上传]()\n    * [7.1 busboy模块](https://github.com/ChenShenhai/koa2-note/blob/master/note/upload/busboy.md)\n    * [7.2 上传文件简单实现](https://github.com/ChenShenhai/koa2-note/blob/master/note/upload/simple.md)\n    * [7.3 异步上传图片实现](https://github.com/ChenShenhai/koa2-note/blob/master/note/upload/pic-async.md)\n* [8. 数据库mysql]()\n    * [8.1 mysql模块](https://github.com/ChenShenhai/koa2-note/blob/master/note/mysql/info.md)    \n    * [8.2 async/await封装使用mysql](https://github.com/ChenShenhai/koa2-note/blob/master/note/mysql/async.md)\n    * [8.3 项目建表初始化](https://github.com/ChenShenhai/koa2-note/blob/master/note/mysql/init.md)\n* [9. JSONP实现]()\n    * [9.1 原生koa2实现JSONP](https://github.com/ChenShenhai/koa2-note/blob/master/note/jsonp/info.md)\n    * [9.2 koa-jsonp中间件](https://github.com/ChenShenhai/koa2-note/blob/master/note/jsonp/koa-jsonp.md)\n* [10. 测试]()\n    * [10.1 单元测试](https://github.com/ChenShenhai/koa2-note/blob/master/note/test/unit.md)\n* [11. debug]()\n    * [11.1 开发debug](https://github.com/ChenShenhai/koa2-note/blob/master/note/debug/info.md)\n* [12. 项目框架搭建]()\n    * [12.1 快速启动](https://github.com/ChenShenhai/koa2-note/blob/master/note/project/start.md)\n    * [12.2 框架设计](https://github.com/ChenShenhai/koa2-note/blob/master/note/project/framework.md)\n    * [12.3 分层操作](https://github.com/ChenShenhai/koa2-note/blob/master/note/project/layer.md)\n    * [12.4 数据库设计](https://github.com/ChenShenhai/koa2-note/blob/master/note/project/sql.md)\n    * [12.5 路由设计](https://github.com/ChenShenhai/koa2-note/blob/master/note/project/route.md)\n    * [12.6 webpack4环境搭建](https://github.com/ChenShenhai/koa2-note/blob/master/note/project/webpack4.md)\n    * [12.7 使用react.js](https://github.com/ChenShenhai/koa2-note/blob/master/note/project/react.md)\n    * [12.8 登录注册功能实现](https://github.com/ChenShenhai/koa2-note/blob/master/note/project/sign.md)\n    * [12.9 session登录态判断处理](https://github.com/ChenShenhai/koa2-note/blob/master/note/project/session.md) \n* [13. 其他进阶]()\n    * [13.1 import/export使用](https://github.com/ChenShenhai/koa2-note/blob/master/note/other/esm.md) \n\n## 前言\n- ES6/7 带来的变革\n\n自ES6确定和ES7的async/await开始普及，node.js的发展变得更加迅速，可以预见到JavaScript中令人“头疼”的多层嵌套回调（注意是”多层嵌套回调“）将会使用Promise + async/await的方式逐渐替代（不是完全替代，多层嵌套回调也有其特殊的应用场景）。\n\n- koa2 大势所趋的前景\n\n基于async/await实现中间体系的koa2框架将会是是node.js web开发方向大势所趋的普及框架。基于generator/yield的koa1将会逐渐被koa2替代，毕竟使用co.js来处理generator是一种过渡的方式，虽然有其特定的应用场景，但是用async/await会更加优雅地实现同步写法。\n\n## 初衷\n\n- 写笔记目的\n\n从学生到工作写了几年的代码，觉得虽然学习新语言，新框架的主要目的是为了解决实际问题，其中更重要的是要每次入门了一门新技术后要及时留下点学习的痕迹，方便以后忘记可以从学习轨迹中迅速上手。\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchenshenhai%2Fkoa2-note","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchenshenhai%2Fkoa2-note","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchenshenhai%2Fkoa2-note/lists"}