Node.js for a New Era: A Beginner's Guide cover

Node.js for a New Era: A Beginner's Guide

No rating yet
Word count
474K words
Chapters
14
Series
Web Front-End Technologies Series
ISBN
9787302487807

Tags

Summary

This book is an introductory guide to Node.js in the Web Front-End Technologies Series from Tsinghua University Press. Its author, Li Kai, graduated from the School of Software at Xiamen University and works in web front-end development. The book is grounded in the state of the technology after standards such as ECMAScript 2015 took hold, and seeks to fill the gap left by the many Chinese Node.js books whose content had grown dated. The book comprises 8 chapters and 6 appendices. The first half begins with what Node.js is, distinguishing it from JavaScript, runtimes, and virtual machines, and explains callbacks, synchronous vs. asynchronous, blocking vs. non-blocking, single-threaded vs. multi-threaded, and parallel vs. concurrent. It then goes deep into the event loop and process.nextTick. The core modules section covers Module and the require mechanism, Buffer, File System, HTTP and TCP services, SSL and HTTPS, WebSocket, Stream, Events, and multi-process services. The second half focuses on engineering practice: writing Node code with ES6 syntax, organizing asynchronous logic with Promise, Generator, and async/await, then building a website with Koa2, including Redis persistence and deployment; it then covers developing a crawler system and anti-crawling measures, testing and debugging, and error-handling strategies. The appendices add material on processes, threads, and coroutines, a Lua primer, building a Node web framework from scratch, MongoDB and Redis, Docker virtualization, and npm package management, helping readers extend their knowledge beyond the basics.

Editor's review

很多 Node.js 入门书只讲“怎么调 API”,这本书真正费笔墨的地方在于回答问题背后的“为什么”。从回调、事件循环到同步/异步与阻塞/非阻塞的区别,作者把 Node 内部机制的脉络先讲清楚,再带你进入模块与网络编程,避免了“照抄代码却不知所以然”的常见困境。第二个值得肯定的地方是它对新标准的敏感:全书把 ES6 语法、Promise 与 async/await 作为书写 Node 代码的常规手段,同时用 Koa2 取代早期的 Express 示例,让读者学到的写法更贴近当下的项目实践。第三个亮点在于实践链条完整:从 Koa2 搭建站点、接入 Redis、部署上线,到爬虫系统的架构改进与反爬处理,再到测试、调试与错误处理,读者能顺着一条有始有终的路径走完小型项目的全流程。六个附录还额外覆盖协程、Lua、自研框架、MongoDB 与 Redis、Docker、npm 包管理,可作为延伸阅读。需要注意的是,本书出版于 2018 年,框架版本与生态已有变化,建议把它当作理解 Node 底层机制与异步思想的入门读物,动手时以官方最新文档为准。

Who it's for

A good fit for

  • 从未接触过 Node.js、但已具备 JavaScript 基础的开发者
  • 希望系统理解事件循环、异步与回调机制的前端工程师
  • 计算机相关专业在校学生及培训班学员,可作为教学参考
  • 想用 Koa2 独立完成小型 Web 站点或爬虫项目的人

Not a good fit for

  • 完全没有编程基础、连 JavaScript 语法都不熟悉的零基础读者
  • 寻求 Koa 之外主流框架(如 Nest.js)或云原生部署方案的进阶读者
  • 需要 2024 年以后新版本 Node 与最新生态内容的读者

Reading tips

  1. 第 1 章的事件循环与异步概念是全书地基,建议反复阅读并配合手写示例验证
  2. 第 2 章模块部分可按需跳读,先掌握 Buffer、HTTP、Stream、多进程四项高频能力
  3. 读完第 4 章后立刻用 async/await 改写自己的旧回调代码,巩固异步思维
  4. 第 5、6 章的项目示例建议亲手跑通一遍,框架版本差异以官方文档为准调整

About the publisher

Tsinghua University Press China · Founded in 1980

Founded in 1980, Tsinghua University Press has 57 titles in our collection, covering popular science, medicine, health, law, philosophy and social sciences. Representative works include medical popular-science books such as Cancer Truth: Doctors Are Reading It Too and New Knowledge on Cancer by Bo Luo (Li Zhizhong), legal titles such as Sunshine Is the Best Preservative: Express Delivery of Major Global Anti-Corruption Cases, and works like Qi Ge's A Brief History of Philosophy with Big Ideas and Liu Yunhao's From the Internet to a New Industrial Revolution. Its authors include science writers, medical researchers, the Renmin University of China anti-corruption master's class and university scholars, reflecting a publishing profile that balances academic seriousness with accessible reading. As public information is limited, this profile is based only on the titles in our collection.

Contents

  1. Chapter 1 Basic Knowledge: What Node Is, Internals, the Event Loop
  2. Chapter 2 Common Modules: Module, Buffer, File System, HTTP, TCP, SSL, WebSocket, Stream, Events, Multi-Process, the Process Object, Timer
  3. Chapter 3 Writing Node with ES6: Block Scope, Arrays, Functions, Set and Map, Iterator, Objects, Classes and Inheritance, ES6 Modularity, Babel Transpilation
  4. Chapter 4 Writing Asynchronous Code: Return Values of Asynchronous Operations, Organizing Callbacks, Promise, Generator, async/await
  5. Chapter 5 Building a Website with Koa2: The Evolution of Node Web Frameworks, Getting Started with Koa, Middleware, Implementing Common Services, Redis Persistence, Inside the Koa Source Code, Website Deployment
  6. Chapter 6 Developing a Crawler System: Overview of Crawler Technology, Tech Stack, Building the Scaffold, Batch Crawling, Improving the Crawler and Process Architecture, Anti-Crawling Measures
  7. Chapter 7 Testing and Debugging: Unit Testing, Testing Existing Code, Testing at a Higher Level, Debugging Node Applications
  8. Chapter 8 Error Handling in Node: The Error Module, Error-Handling Approaches, Domain, Error Handling in ES6, Error Handling in Web Services, Defensive Programming and Let It Crash
  9. Appendix A Processes, Threads, and Coroutines
  10. Appendix B A Brief Introduction to Lua
  11. Appendix C Building a Node Web Framework from Scratch
  12. Appendix D A Brief Introduction to MongoDB and Redis
  13. Appendix E Using Docker for Virtualization
  14. Appendix F npm and Package Management

FAQ

这本书适合零基础学 Node.js 吗?
需要一点 JavaScript 基础。作者在“本书面向的读者”中说明面向未接触过 Node 的读者,但书中直接使用 ES6 语法与回调、Promise 等概念,若完全没写过 JavaScript,建议先补语法再读第 1 章。
书里的示例用的什么框架和版本?
Web 站点部分使用 Koa2,异步代码部分介绍了 Promise、Generator 与 async/await,测试调试章节涉及单元测试。由于成书于 2018 年前后,实际动手时请对照当前 Node 与 Koa 官方文档调整写法。
全书有哪些章节和附录?
正文 8 章:基础知识、常用模块、用 ES6 书写 Node、书写异步代码、用 Koa2 构建 Web 站点、爬虫系统开发、测试与调试、Node 中的错误处理;另有 6 个附录,涵盖进程线程协程、Lua、自研 Web 框架、MongoDB 与 Redis、Docker、npm 包管理。
这本书的出版信息和篇幅如何?
由清华大学出版社出版,属“Web前端技术丛书”,2018 年 1 月第 1 版,ISBN 9787302487807,平装 279 页,约 47.4 万字,定价 49 元。
书中的 Node.js 内容现在会不会过时?
底层机制如事件循环、Buffer、Stream、多进程等依然适用,是最有价值的部分;但框架版本、ES 模块加载、npm 生态细节已有变化,建议把机制章节精读,工程示例以最新官方文档为准。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

About the author

李锴 Author

Li Kai is an author about whom very limited public information is available; his English name, nationality, and dates of birth and death cannot be confirmed from public sources. Only one work by him is currently held in the collection, Li Tiejun's Literary Selections (Li Tiejun Wenchao), which is classified under Eastern philosophy and serves as the main basis for understanding his writing. Judging from the title, "literary selections" suggests an anthology or collection of essays, possibly including learned discussions, notes, or miscellaneous writings that correspond to the focus on Eastern philosophy. Because there are no reliable records of his life, teachers, or historical background, it is not possible to determine his intellectual origins or historical standing; readers can only appreciate the character of his writing through this single text. Overall, Li Kai remains an author whose materials await further discovery, and the length and circulation of his work are also unclear. Researchers seeking a deeper discussion would still need more documentary evidence.

More by the same author

Top rated in the same category