Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
使用 Node.js 构建 Web 开发解决方案-EMBBNUX
Search
Embbnux Ji
October 21, 2016
Technology
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
使用 Node.js 构建 Web 开发解决方案-EMBBNUX
使用 Node.js 构建 Web 开发解决方案, 讲诉如何用 koa 从零构建一个web 开发框架
Embbnux Ji
October 21, 2016
Other Decks in Technology
See All in Technology
会社説明資料
persolserverworks
0
9.8k
スプシの手作業からの解脱 ~更新はClaude Codeに、見せ方と使い方はGASアプリに任せる~
kentarofujii
0
160
SAENM ~Jupyterで残すPoCの試行錯誤、未来の自分と仲間を助ける記録!~
terapyon
0
120
AI時代のPRレビューにどう向き合うか?
kairim0
1
240
自作バイナリを動かす「入口」8選
puhitaku
2
1.3k
「Docker Desktop不要の時代」は 来たのか?
ueponx
0
830
Persisting Massive Data with Rails ~Designing for 60 billion rows, and fighting the bottlenecks~ Railsで挑む大量データ永続化 〜600億件を永続化するための設計とボトルネックとの戦い〜
occhi
0
740
USB PDを使ってスマホを労わりたい
raspython3
0
180
フロントエンドカンファレンス関西2026 - 速すぎるUIに、待ち時間を
teamlab
PRO
0
190
AI × アーキテクト 第1・2章|生成AIの課題とアーキテクトの素養
daidaidai
0
180
ウォンテッドリーの最近のプロダクトと技術の紹介
stomk
0
130
オントロジーって 結局なにもの? AI エージェントに「意味」を渡す知識設計の話
greenmidori
0
230
Featured
See All Featured
The Spectacular Lies of Maps
axbom
PRO
1
1.1k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.6k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.3k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
2
360
Thoughts on Productivity
jonyablonski
76
5.4k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
400
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
360
Art, The Web, and Tiny UX
lynnandtonic
304
22k
It's Worth the Effort
3n
188
29k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Transcript
使⽤用 Node.js 构建 Web 开发解决⽅方案 Embbnux Ji
About Me • embbnux@all • github: github.com/embbnux • 个⼈人博客: www.embbnux.com
• 开源 Web 项⽬目: github.com/embbnux/kails • 标签: docker, rails, node.js, 开源硬件
Why Node.js ?
Why Node.js ? • 跑在服务器器上的 v8 引擎 • 事件驱动 •
⾮非阻塞 IO • 单线程 • 活跃的社区,300000+ 个npm 包
⾼高性能,轻量量 天猫双⼗十⼀一数据,引⾃自<dead-horse : ⽤用 Node.js 构建海海量量⻚页⾯面渲染服务 >
框架选择 • Express • 优点:使⽤用⼴广泛,功能⼤大⽽而多,⾃自带路路由模版等。 • 确定: 掌控⼒力力低,原开发⼈人⻢马跑路路!
框架选择 • connect • 精简的内核,兼容 express 中间件 • 组件⾃自⼰己实现,⾃自由掌控 •
使⽤用⼈人较少
框架选择 • koa • express 原班⼈人⻢马新作 • es6 特性,基于 generator
• 灵活的中间件模型
koa 与 express • express: • 中间件顺序执⾏行行,已经发送的body⽆无法修改 • koa: •
包裹着后⾯面所有中间件的修饰器器 • 所有中间件执⾏行行完发送请求头
koa 实战 • 官⽅方例例程:
啥?⼀一切从头开始!
架构 还是 MVC
路路由分发 还是 restful !
async 和 await ⽀支持 • 为了了更更加简单好⽤用的异步编程, 以及使⽤用 koa 2 •
同步写法的异步编程,拒绝 callback
环境 • development 环境 • test 环境 • production 环境
接⼊入redis • redis 既可以当 web 的缓存, 加速⽹网络请求 • 也可以当 session
store, 加速 session 存取
利利⽤用中间件特性 提⾼高代码复⽤用率
react 前后端同构 浏览器器与服务器器模板复⽤用
⾼高性能中间层 • 利利⽤用 node.js ⾮非阻塞 io 特性构建⾼高性能中间层 • 在服务器器端不不会有并发⽹网络请求数的限制, •
可以同时并发发起多个⽹网络请求,时间为 max(1 .. n)
⼯工程化 • 测试(单元测试 集成测试):mocha, chai • lint: eslint 规划你的 js
代码 • ci ⾃自动测试 ⾃自动集成 ⾃自动部署发布
欢迎交流 参考[1]: dead-horse - ⽤用 Node.js 构建海海量量⻚页⾯面渲染服务 参考[2]: dead-horse -
Node.js 掠影 kails: github.com/embbnux/kails 欢迎 pull request 和 star blog: www.embbnux.com