我正在使用express.js框架在heroku上运行node.js服务器.
这是我的服务器的样子:
var express = require('express');
var app = express();
app.use(express.static(__dirname + '/static'));
var port = process.env.PORT || 8000;
app.listen(port);
Run Code Online (Sandbox Code Playgroud)
我的index.html文件包含以下javascript链接:
<script src="/js/chartview.js"></script>
<script src="/js/bootstrap.js"></script>
<script src="/js/bootstrap-select.js"></script>
Run Code Online (Sandbox Code Playgroud)
我的目录系统如下所示:
server.js
/static
-index.html
-/js
-bootstrap.js
-bootstrap-select.js
-chartview.js
-/css
-bootstrap.css
-bootstrap-select.css
-styles.css
Run Code Online (Sandbox Code Playgroud)
Chrome会使用相应的css样式显示我的html页面,但控制台会说:
Failed to load resource: the server responded with a status of 404 (Not Found) https://websitename.herokuapp.com/js/chartview.js
Failed to load resource: the server responded with a status of 404 (Not Found) https://websitename.herokuapp.com/js/bootstrap.js
Failed to load resource: the server responded with a status …Run Code Online (Sandbox Code Playgroud)