var http = require('http');
var fs = require('fs');
var url = require('url');
http.createServer( function (request, response) {
var pathname = url.parse(request.url).pathname;
console.log("Request for " + pathname + " received.");
response.writeHead(200, {'Content-Type': 'text/html'});
fs.readFile('./head.html',function(e,head){
fs.readFile(pathname.substr(1), function (err, data) {
fs.readFile('./foot.html',function(e,foot){
console.log(head.toString())
console.log(foot.toString())
response.write("");
response.write("");
response.write("");
response.write("");
response.write("標(biāo)題一 ");
response.write("");
response.write(data.toString());
response.write(foot.toString());
response.end();
})
});
})
}).listen(3000);
console.log('Server running at http://127.0.0.1:3000/');
標(biāo)題
b. index.html:
身體
這是一段文字
c. foot.html:
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。