简而言之:当我访问时,我怎样才能得到st服务?index.html/
我在 Express 中使用st 模块(或 Connect,没关系)。这是我的全部代码:
var st = require('st');
var path = require('path');
var connect = require('connect');
var app = connect();
app.use(st({
url: '/',
path: path.resolve(__dirname, 'public'),
index: 'index.html', // !!! PROBLEM LINE !!!
cache: false,
passthrough: true
}));
app.use(function(req, res) {
res.end('This is not served from the st module.');
});
app.listen(8000, function() { console.log('App started.'); });
当我访问时localhost:8000/index.html,我看到了文件。当我访问时localhost:8000/,我没有看到索引 HTML。
我已经尝试了以下index选项,但没有运气:
index: falseindex: trueindex: 'index.html'index: 'public/index.html'index: path.resolve(__dirname, 'public/index.html')
当我访问时,我怎样才能得到st服务?index.html/