Download node Install NPM I won't say anything.
Introductory summary
Http://www.cnblogs.com/Darren_code/archive/2011/10/31/nodejs.html
Enter the Node_home directory
Test.js
/*var hello = require ('./hello.js '); Console.log (' hello.location: ' + hello.location ') console.log (' hello.location: ' + Hello.name) Hello.showlog ();*/ varFS = require ('FS'); Console.log (' One'); varHello = require ('./hello.js'); Console.log (' A'); Fs.readfile ('./hello.js', function (err, data) {if(ERR)Throwerr; Console.log ('successfully'); }); Console.log ('Async');varEvents = require ("Events"); varEmitter =Newevents. Eventemitter (); Emitter.on ("MyEvent", Function (msg) {Console.log (msg); }); Emitter.emit ("MyEvent","Hello World.");varFS = require ('FS'); Fs.unlink ('./hello.js', function (err) {if(ERR)Throwerr; Console.log ('successfully deleted Mymodule.js'); });
Hello.js
Console.log ('xx'); var " Darren " ; This"Beijing"; this. Showlog = function () { console.log ('Hi Darren. ' )};
Output:
11
00
22
Async
Hello World.
Successfully deleted Mymodule.js
Successfully
Analysis of Basic concepts:
Module: In fact, the equivalent of a JS class, through the require (path) way to create and introduce a module
Asynchronous:
Node each built-in module and its API
Sys
Fs
http
Agent
wr.
Path
File
Events
http://nodejs.iteye.com/blog/1587019
In general, JS through the Eval assembly service end of the JSON string into a JS object-the server has another JSON interpreter
var AA = Json.parse ("{\" a\ ": \" C\ "}"); JSON is also built into JS
Server-side request processing of the browser is usually: each request to establish a thread ...?
Be sure to understand what the problem you need to solve, and take the best solution based on it, instead of solving the problem based on the skills you are currently mastering
Node's advantages:
Non-blocking (asynchronous),
High concurrency (asynchronous, event-based I/O)
Building Scalable Web Applications (single thread _ traditional Web server one request, multithreaded)
Very Good article:
Http://www.cnblogs.com/liusuqi/p/3735491.html