目录结构
images
style.css
.......
js
jquery.min.js
index.js
node_modules
socket.io
index.html
server.js
我在index.html 里写的
都无效,请问是server.js里还需要怎么配置下吗?目录结构
images
style.css
.......
js
jquery.min.js
index.js
node_modules
socket.io
index.html
server.js
我在index.html 里写的
都无效,请问是server.js里还需要怎么配置下吗?需要自己读文件流,然后返回 :D
var http = require('http');
var url = require('url');
var fs = require('fs');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
var content = fs.readFileSync('index.html');
res.write(content);
res.end();
}).listen(9337);
console.log('Server running at http://127.0.0.1:9337/');