0

我有理由避免这样做吗?

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");
});
4

1 回答 1

0

您需要使用res.write并且res.end()只需读取文件的内容即可访问require('fs')您可以res.set(field, [value])用于标题的核心

完整文档

于 2013-06-12T22:09:12.883 回答