NodeJS禁用缓存 [英] NodeJS disable cache
问题描述
我现在正在学习NodeJS,我想使用Mustache-express作为模板引擎(我想用它代替Pug,因为我之前在FrontEnd上使用过它,并且我认为这是一个非常智能,简单的模板系统).我使用nodemon运行NodeJS服务器,它可以正常工作,每次更改除视图之外的任何文件时,它都会重新启动.当我更改视图文件中的任何内容时,仅当我重新启动NodeJS服务器时,才在请求的响应中看不到它.我该怎么办?
I now learning NodeJS and I want to use Mustache-express as the template engine (I want to use it instead of Pug, because I used it before on FrontEnd and I think it's a really smart and easy template system). I use nodemon to run the NodeJS server and it's work correctly, it restart every time when I change any file, except the views. When I change anything in the view files, I don't seem it in the requests' responses, only when I restart the NodeJS server. What can I do with that?
我已经用以下代码创建了缓存:
I already turned out the cache with the following code:
app.disable('etag');
推荐答案
使用命令 nodemon -e js,html
运行nodemon(如果视图的扩展名不是html,则将其替换)
Run nodemon with the command nodemon -e js,html
(if the extension of your views is not html, then replace it)
这篇关于NodeJS禁用缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!