Some node stuff for Lighthouse Labs.
- javascript everywhere
- modules
- callbacks
- events
- async i/o & event loop
- streams
- https://npmjs.org/
- http://nodejs.org/api
- https://iojs.org/api/errors.html
- http://nodeschool.io/
- https://github.com/maxogden/art-of-node
- https://github.com/substack/stream-handbook
- slide 3: now maintained by the Node.js Foundation
- slide 7: npm doesn't stand for anything
- slide 12:
process
isn't the global context,global
is - important:
require()
is a function and not part of the language - mention node core module docs at nodejs.org/api
# adds to your package.json
$ npm install --save <module>
# adds to your package.json devDependencies
$ npm install --save-dev <module>
# too lazy to type install?
$ npm i <module>
Using npm run instead of Make, Rake, or gulp: substack
- don't write code, use npm
- don't starve the main thread
- if you have expensive CPU operations, use
process.nextTick
- use node-inspector
- use nodemon
- pin versions in package.json
- avoid cluster for scaling: spawn many processes and load balance