Node JS Application Platform - server side JavaScript, compete with Ruby, Python, PHP & Perl.
1. Node is built base on Google V8 JS Engine. Fast.
2. Node does not use Thread. use Events.
Traditional application server create new thread for each incoming client connection, or they share a pool of threads. This limits their max. level of performance. Memory is needed to manage each thread, and processor time is needed to switch btw threads. You also have to worry about all the bugs that threads cause: deadlocks, race conditions, inconsistent shared data, etc.
Node avoids all this. There is only one thread and everything happens consecutively.
3. Install Node by downloading and compiling from source code:
first, download latest source code:
$ wget http://nodejs.org/dist/v0.12.2/node-v0.12.2.tar.gz
extract archive:
$ tar -xzf node-v0.12.2.tar.gz
go to node source folder and run the compilation command
$ cd node-v0.12.2
$ ./configure
$ make
$ make install
check version installed:
$ node -v
4. Using the Node Package Manager (npm)
Make use of npm to download and install module required by ur node js
To install npm:
first become root:
$ sudo -s
download npm installer and install
$ curl http://npmjs.org/install.sh | sh
confirm installation
$ npm -v
can start download and install node module now:
$ npm install {mdoule-name}
5. common Node Module
connect module - allow u to define series of layers the http client request pass through. e.g. divert, authentication, logging or caching, etc.
沒有留言:
張貼留言