我有理由避免这样做吗?
app.configure(function(){
app.set('port', process.env.PORT || 3000);
app.set("view options", {layout: false});
app.use(express.static(__dirname + '/views'));
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));
});
var html_dir = './views/';
app.get('/', function(req, res){
res.sendfile(html_dir + "login.html");
});
答案 0 :(得分:0)
您需要使用res.write
和res.end()
,只需阅读文件内容与核心require('fs')
,您可以使用res.set(field, [value])
作为标题