0

我在我的应用程序上配置了 2 个中间件:

app.use(express.static(__dirname + '/public'));
app.use("/assets",  express.static(__dirname + '/assets'));

我试图让一些工作,我添加了以下内容:

app.use("/public",  express.static(__dirname + '/public'));

但是我遇到了更多麻烦并决定将其删除,但是该应用程序似乎仍在使用它。在添加之前,我有一个可以正常工作的 products.ejs 页面,但现在所有链接都已损坏,并且在控制台检查器中出现 2 个错误:

1-Refused to apply style from '<URL>' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

2-http://localhost:3000/products/assets/js/vendor/modernizr-2.8.3-respond-1.4.2.min.js

我的资产文件夹位于我的根目录中,因此在第二个错误中似乎旧中间件仍在将产品添加到路由中,即使我删除了它。

此外,如果我重命名 ejs 并将路线从 /products 更改为 /product 并且渲染也一切正常。

4

0 回答 0