删除了仍在使用的中间件

时间:2019-01-09 11:35:32

标签: node.js express

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

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

我试图使某些事情起作用,并添加了以下内容:

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

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

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-{{​​1}}

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

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

0 个答案:

没有答案
相关问题