第1页
FOR EVERYTHING
A SHORT STORY BY CHARLIE KEY
charlie@modulus.io - @zwigby
第6页
0.6.8
第7页
LET YOUR PROCESS CRASH
pm2
Modern CLI process manager for Node apps with a builtin load-balancer
$
npm
install
pm2@latest
-‐g
$
pm2
start
app.js
forever
A simple CLI tool for ensuring that a given node script runs continuously (i.e. forever)
$
npm
install
forever
-‐g
$
forever
start
app.js
第8页
FIND ISSUES
node-‐inspector
Web Inspector based nodeJS debugger
$
npm
install
node-‐inspector
-‐g $
node-‐debug
app.js
第10页
FULCRUM
(CLI)
APERTURE
(WEBSITE)
CONGRESS
(API)
MEDUSA
(DEPLOYMENT MANAGER)
APP HOST
INCOMING TRAFFIC
LOAD BALANCER CUSTOMER APP METRICS COLLECTION
第12页
npm versioning
No
Asterisks
Please for the love don’t use asterisks. "dependencies":
{
"express":
"*"
}
Use proper versioning. "dependencies":
{
"express":
"4.0"
}
第13页
LESSONS LEARNED
stateless
Keep your application as stateless as possible
redis
Great tool if you need to keep state
第15页
API
The natural born use case for Node.js
express
Fast, unopinionated, minimalist web framework
hapi
HTTP Server framework - from the minds at Walmart
restify
REST framework
第16页
FINAL THOUGHTS
horizontal
scalability
Be stateless or have a thought out solution
don’t
reinvent
the
wheel
unless you want to, npm is there for a reason
start
testing
early
Pick a testing framework and start writing tests
streams
Learn to use them - streams adventure
kiss
Keep it simple stupid
第17页
SLIDE OF MANY THINGS
pm2
www.npmjs.org/package/pm2
forever
www.npmjs.org/package/forever
node-‐inspector
www.npmjs.org/package/node-‐inspector
npm
semver
www.npmjs.org/doc/misc/semver.html
redis
redis.io
expressjs
expressjs.com
hapi
hapijs.com
restify
mcavage.me/node-‐restify
jasmine
jasmine.github.io
stream-‐adventure
www.npmjs.org/package/stream-‐adventure
!
第18页
@zwigby