优化缓存

This commit is contained in:
binaryify
2017-08-17 16:39:32 +08:00
parent cde7863060
commit 53b75c31cc
4 changed files with 4 additions and 5 deletions

3
app.js
View File

@ -17,8 +17,9 @@ let cache = apicache.middleware
// }
// next()
// })
const onlyStatus200 = (req, res) => res.statusCode === 200
app.use(cache('2 minutes'))
app.use(cache('2 minutes', onlyStatus200))
app.use(express.static('public'))