How do I enable caching for static files but disable for non-static page requests?
I set this statement for static and it works fine.
app.use(express.static(path.join(__dirname, 'public') ,{ maxAge: 800000 }));
But, how do I set no-cache for non-static rendered page requests? (those under views folder rendered by Jade)
Thanks
Rendered pages shouldn't go in the public folder put them in a folder such as views/ . Then the middleware will not cache them
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.