这里是node.js的HTTP服务器:
var fs = require('fs');
var http = require ('http');
http.createServer(function (request, response) {
console.log('request starting...');
fs.readFile('C:/Users/.../index.html', function(error, content) {
if (error) {
response.writeHead(500);
response.end();
} else {
//response.writeHead(200, { 'Content-Type': 'text/html' });
response.end(content, 'utf-8');
}
console.log(error);
});
}).listen(8080);
的问题是,该指数。 html文件以良好的方式返回,但所有的JavaScript文件和CSS都没有正确发送到客户端。问题是如何发送这些.js和.css文件?
2011-12-11
0x90
+0
你能更具体?你是什么意思“不正确发送”..?有没有错误,你能告诉我们堆栈跟踪吗??!什么? –
+0
我希望我没有调试工具的node.js ...我想我回到PHP :( –