我正在尝试在 express3 中路由文件,但我遇到了问题。
所以这是路由文件的代码 -
var app = require('express')(),
server = require('http').createServer(app),
io = require('socket.io').listen(server);
server.listen(8080);
// routing
app.get('/', function (req, res) {
res.sendfile("index/index.html");
app.use(app.static(__dirname + 'index'));
});
当我localhost:8080
在 Chrome 中打开时,它给了我一个错误:
TypeError: Object function app(req, res){ app.handle(req, res); } has no method 'static'
我做错了什么?
我所有的 HTML/CSS/JS 文件都在 index 目录中。