首页 > 代码库 > nodejs 2014-12-12

nodejs 2014-12-12

http://www.linuxidc.com/Linux/2012-10/72627.htm

see version 

node --version


helloworld.js

var http = require(‘http‘);   
server = http.createServer(function (req, res) {   
      res.writeHeader(200, {"Content-Type": "text/plain"});   
      res.end("Hello World\n");   
})   
server.listen(8000);   
console.log("httpd start @8000");


run on DOS

node helloworld.js


enter the url in explorer

http://localhost:8000/


you will see "Hello World"



nodejs 2014-12-12