Today I began with node.js. My overall goal is to develop some JavaScript chops.
IntelliJ IDEA
I also finally unwrapped my IntelliJ IDEA 12.0 install. I bought this bad boy back when JetBrains was having a fire sale to celebrate the end of the world. :)
- the NodeJs plugin doesn't come bundled with IntelliJ, I had to download it.
- I created a "Node Boilerplate" project. Not sure what that is, yet.
- there's a script ya run that initializes the project.
- it used npm to download a bunch of dependencies: Jade, Mocha, socket.io, should, growl, formidable, mongodb, and a bunch of others.
- it then seemed to run a mongodb installer. That included this comment:
"To install with C++ bson parser do <npm install mongodb --mongodb:native>"
- it then showed a dependency tree:
should@1.2.1 ./node_modules/should
vows@0.5.13 ./node_modules/vows
└── eyes@0.1.8
jade@0.20.0 ./node_modules/jade
├── commander@0.2.1
└── mkdirp@0.3.4
express@2.5.2 ./node_modules/express
├── mkdirp@0.0.7
├── mime@1.2.9
└── qs@0.5.3
connect@1.8.5 ./node_modules/connect
├── mime@1.2.9
├── formidable@1.0.11
└── qs@0.5.3
mocha@1.8.1 ./node_modules/mocha
├── growl@1.7.0
├── commander@0.6.1
├── debug@0.7.2
├── diff@1.0.2
├── mkdirp@0.3.3
├── ms@0.3.0
└── jade@0.26.3
mongoose@2.4.8 ./node_modules/mongoose
├── colors@0.5.1
├── hooks@0.1.9
└── mongodb@0.9.7-2-5
socket.io@0.8.7 ./node_modules/socket.io
├── policyfile@0.0.4
├── redis@0.6.7
└── socket.io-client@0.8.7
I noticed that the same top-level packages were listed in $project/node_modules/
Ummm... wow, that's kindof a lot to start with. All I really want, right now, is just a simple node.js app.
Simple node.js
This was watching Ryan Dahl playing with node.js
- process is a global object not unlike the "window" object in JavaScript-in-the-browser environments
- you cannot sleep in node. You never halt execution.
- node exists when there's nothing left to do. This includes stuff like registered callbacks.