[英]node-static is sending .aspx extension content as download
我不知道如何使用node-static服务器.aspx文件。
我使用node-static来提供.html .js .css和images(按预期工作),但当我请求test.aspx(公共文件夹中的文件)时,它会提示浏览器(Chrome和FF)下载为文件,当我希望它被视为HTML(text / html)。
节点代码非常基本
var node_static = require('node-static');
var node_static_file = new(node_static.Server)('./public');
var http = require('http');
var server = http.createServer(function(req, res) {
// static file server
req.addListener('end', function () {
node_static_file.serve(req, res, function (err, result) {
if (err) { // There was an error serving the file
res.writeHead(err.status, err.headers);
res.write("Error: Page " + err.message + " (" + err.status + ")");
res.end();
}
});
});
}).listen(80);
谢谢,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.