Node.js進(jìn)階之路 版權(quán)信息
- ISBN:9787302456933
- 條形碼:9787302456933 ; 978-7-302-45693-3
- 裝幀:一般膠版紙
- 冊數(shù):暫無
- 重量:暫無
- 所屬分類:>>
Node.js進(jìn)階之路 本書特色
本書內(nèi)容涵蓋了 Node.js高并發(fā)的原理、源碼分析以及使用 Node.js開發(fā)應(yīng)用所需要的不同層面
的技術(shù)實(shí)踐。具體來講,本書包括 Node.js異步機(jī)制(配以源碼分析)、編輯與調(diào)試、測試技術(shù)、
Docker 部署、模塊機(jī)制、V8 引擎與代碼優(yōu)化、Promise 和 ES6 Generator、LoopBack 開源框架、使
用 C 編寫擴(kuò)展、JavaScript嚴(yán)格模式、編碼規(guī)范等內(nèi)容。在 LoopBack 章節(jié),本書詳細(xì)介紹了使
用此框架開發(fā)企業(yè)級(jí) Web 應(yīng)用的步驟,幫助讀者迅速掌握使用這個(gè)強(qiáng)大框架的訣竅。*后一章詳
細(xì)介紹了編寫不同類型的 C 模塊的知識(shí),并對(duì)堆內(nèi)存管理等內(nèi)容做了深入探討。本書適合所有前端和后端的開發(fā)人員閱讀。
Node.js進(jìn)階之路 內(nèi)容簡介
一線Node開發(fā)者數(shù)年實(shí)戰(zhàn)經(jīng)驗(yàn)總結(jié),適合所有前端和后端的開發(fā)人員閱讀本書內(nèi)容涵蓋Node 高并發(fā)的原理、源碼分析以及使用 Node 開發(fā)應(yīng)用所需要的不同層面的技術(shù)實(shí)踐。具體包括 Node 異步機(jī)制(配以源碼分析),編輯與調(diào)試,測試技術(shù),Docker 部署,模塊機(jī)制,V8 引擎與代碼優(yōu)化,Promise 和 ES6 generator ,LoopBack 開源框架,使用 C 編寫擴(kuò)展,JavaScript 嚴(yán)格模式,編碼規(guī)范等內(nèi)容。
Node.js進(jìn)階之路 目錄
目 錄
第1章 Node異步編程范式 ·····························································1
1.1 同步與異步的比較 ········································································2
1.2 Node異步的實(shí)現(xiàn) ···········································································7
1.2.1 HTTP請(qǐng)求——完全異步的例子 ·························································8
1.2.2 本地磁盤I/O——多線程模擬 ··························································17
1.3 事件驅(qū)動(dòng) ··················································································18
參考資料 ····························································································19
第2章 搭建自己的開發(fā)環(huán)境 ·························································21
2.1 Node的編譯與安裝 ······································································22
2.2 開發(fā)與調(diào)試 ···············································································23
2.3 單元測試 ··················································································29
2.3.1 Mocha 測試框架 ··········································································29
2.3.2 TDD 風(fēng)格 ··················································································32
2.3.3 BDD 風(fēng)格 ··················································································34
2.3.4 生成不同形式的測試報(bào)告 ······························································35
2.3.5 代碼覆蓋率工具Istanbul·································································36
參考資料 ····························································································40
第3章 使用Docker部署Node服務(wù) ··················································43
3.1 Docker基礎(chǔ) ···············································································44
3.2 在Docker中運(yùn)行Node
··································································· 45
3.3 導(dǎo)出配置好的容器 ······································································
47
參考資料 ····························································································
48
第4章 Node模塊 ·······································································
49
4.1 程序入口 ··················································································
50
4.2 VM模塊 ···················································································
50
4.3 模塊加載與緩存 ·········································································
52
4.4 模塊分類 ··················································································
54
4.5 正確導(dǎo)出模塊 ············································································
55
4.6 小心使用全局變量 ······································································
56
第5章 V8引擎 ··········································································
57
5.1 Java Script代碼的編譯與優(yōu)化 ·························································
58
5.1.1 即時(shí)編譯 ···················································································
58
5.1.2 隱藏類 ······················································································
59
5.1.3 內(nèi)聯(lián)緩存 ···················································································
60
5.1.4 優(yōu)化回退 ···················································································
61
5.1.5 寫出更具親和性的代碼 ·································································
62
5.1.6 借助TypeScript
············································································ 635.2 垃圾回收與內(nèi)存控制 ···································································
65
5.2.1 V8的垃圾回收算法 ·······································································
65
5.2.2 使用Buffer
·················································································
67
5.2.3 避免內(nèi)存泄漏 ·············································································
70
參考資料 ····························································································
77
V
第6章 Promise對(duì)象 ····································································
79
6.1 Promise的含義 ···········································································
80
6.2 基本用法 ··················································································
80
6.3 then的鏈?zhǔn)綄懛?··········································································
82
6.4 bluebird庫 ·················································································
85
參考資料 ····························································································
86
第7章 用ES6 Generator解決回調(diào)金字塔 ·········································
87
7.1 Node異步實(shí)現(xiàn)流程 ······································································
88
7.2 用Generator實(shí)現(xiàn)異步調(diào)用與多并發(fā) ·················································
89
7.3 嚴(yán)格模式下運(yùn)行 ·········································································
99
7.4 理解執(zhí)行過程 ···········································································1007.5 本章結(jié)語 ·················································································106第8章 LoopBack開源框架 ··························································1078.1 安裝與運(yùn)行 ··············································································1088.2 路由與權(quán)限控制 ········································································1138.3 添加新模型 ··············································································1218.4 初始化數(shù)據(jù)庫 ···········································································1318.5 鉤子機(jī)制 ·················································································1348.6 中間件 ····················································································1378.7 模型關(guān)系 ·················································································1398.8 使用cluster模式運(yùn)行服務(wù) ·····························································141參考資料 ···························································································
144
第9章 編寫C 擴(kuò)展 ·································································1459.1 使用C 編寫擴(kuò)展模塊 ································································1469.1.1 導(dǎo)出對(duì)象 ··················································································
146
9.1.2 導(dǎo)出函數(shù) ··················································································
149
9.1.3 導(dǎo)出構(gòu)造函數(shù) ············································································
151
9.2 線程模型與CPU密集型任務(wù) ·························································1649.3 線程對(duì)象 ·················································································1649.4 本章結(jié)語 ·················································································170參考資料 ···························································································
170
附 錄 ·····················································································171附錄 A
JavaScript 嚴(yán)格模式 ·······························································172附錄 B
JavaScript 編碼規(guī)范 ······························································182參考資料 ···························································································
195
展開全部
Node.js進(jìn)階之路 作者簡介
尤嘉,東南大學(xué)計(jì)算機(jī)碩士,從事軟件研發(fā)工作多年,先后就職于奇虎和獵豹移動(dòng)。做過基于 chromium 的瀏覽器,也從事過 WebKit 與 V8 方面的研發(fā)工作。目前從事 P2P 與區(qū)塊鏈方面的項(xiàng)目研發(fā)。