</pre><p>众所周知 express是对http的封装,express 会在后台调用http模块。</p><p>express对比http 有哪些区别?</p><p>1.express可以通过http的不同方法进行过滤(post,get)</p><p>2.express可以通过特定的url进行过滤</p><p></p><pre name="code" class="javascript">var express = require('express');
var app = express.createServer();
app.get('/',function(req,res)){
res.send('Hello World');
}
app.listen(8000)
var http = require("http");
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/html"});
response.write("Hello World!");
response.end();
}).listen(8080);
console.log("Server running at http://localhost:8080/");
源码分析: