NodeJS入门

什么是NodeJS?

难道我会告诉你百度一下,你就知道?

NodeJS能干啥?

转自玉伯

通过 Node,前端程序员可以摇身一变,变成传统程序员。数据库、网络、业务架构等等技术核心领域,都可以通过 JavaScript 来达成。

NodeJS安装(win7)

1.下载NodeJs

2.在nodeJS的安装目录新建一个hello.js,代码如下:console.log('hello, nodejs.');

3.如果你的安装路径不是默认路径,可以使用cd回到根目录,然后转到你的安装路径,如下:

NodeJS入门

4.进入命令控制台,输入node hello.js,输出如下:

NodeJS入门

5.在浏览器中输出,在nodeJS安装目录新建一个http.js,代码如下:

var http = require("http");
http.createServer(function(request, response) {
    response.writeHead(200, {"Content-Type": "text/html"});
    response.write("Hello World!");
    response.end();
}).listen(8000);

6.在命令行中输入:node http.js,然后打开http://localhost:8000/,你就可以看到hello word!

NodeJS入门

NodeJS入门

官方网站:http://nodejs.org/

中文官网:http://cnodejs.org/

node入门:http://www.nodebeginner.org/index-zh-cn.html

node api:http://nodejs.org/api/

expressjs:http://expressjs.com/guide.html http://expressjs.jser.us/api.html(中文资料、api)
ejs: https://github.com/visionmedia/ejs
mongodb api:http://mongodb.github.com/node-mongodb-native/api-generated/collection.html