以MIME类型text/html传输的方式运行时从expressjs获取错误
我作为本地服务器运行以MIME类型text/html传输的方式运行时从expressjs获取错误,html,express,content-type,Html,Express,Content Type,我作为本地服务器运行expressjs。我得到了这样的错误。。这里怎么了 Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:3000/js/lib/bootstrap/dist/css/bootstrap.min.css". localhost/:11 Resource interpreted as Script but transferred with M
expressjs
。我得到了这样的错误。。这里怎么了
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://localhost:3000/js/lib/bootstrap/dist/css/bootstrap.min.css".
localhost/:11 Resource interpreted as Script but transferred with MIME type text/html: "http://localhost:3000/js/lib/angular/angular.min.js".
localhost/:10 Resource interpreted as Script but transferred with MIME type text/html: "http://localhost:3000/js/lib/jquery/dist/jquery.min.js".
localhost/:12 Resource interpreted as Script but transferred with MIME type text/html: "http://localhost:3000/js/scripts/app.js".
这是我的html:
<!DOCTYPE html>
<html ng-app="myNewApp">
<head>
<meta charset="utf-8"> //i already declared the content type here.
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>My New App!</title>
<link rel="stylesheet" href="/js/lib/bootstrap/dist/css/bootstrap.min.css">
</head>
<body>
<script src="/js/lib/jquery/dist/jquery.min.js"></script>
<script src="/js/lib/angular/angular.min.js"></script>
<script src="/js/scripts/app.js"></script>
</body>
</html>
我将所有
lib
资产移动到public
目录。它是有效的。为什么app.get('*',…
而不是app.get('/',…
?我想两者都是一样的。*
小心点……我不这么认为。试着把它换掉,看看吧
var express = require("express"),
app = express();
app
.use(express.static( __dirname + 'public'));
app
.get('*', function (req, res) {
res.sendfile('public/main.html');
})
app.listen(3000);