【发布时间】:2014-12-12 20:53:32
【问题描述】:
我正在尝试使用 AppFog 创建一个 Node 应用程序,我首先将 index.html 包含在我的 app.js 中
var http = require('http'),
fs = require('fs');
fs.readFile('./index.html', function (err, html) {
if (err) {
throw err;
}
http.createServer(function(request, response) {
response.writeHeader(200, {"Content-Type": "text/html"});
response.write(html);
response.end();
}).listen(8000);
});
然后索引包括脚本和 css
<!-- jQuery -->
<script src="script/jquery-2.1.1.min.js" type="text/javascript"></script>
<script src="base.js" type="text/javascript"></script>
<!-- Bootstrap -->
<script src="Bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="Bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="Bootstrap/css/bootstrap-theme.min.css">
<!-- Main CSS -->
<link rel="stylesheet" href="main.css">
index.html 正在正确加载,但脚本和样式却没有。
该站点是THIS,如果您要查看,从控制台可以看到每个文件都返回 index.html 而不是 JS 代码或 CSS 样式。
【问题讨论】:
标签: javascript css node.js include appfog