Reputation: 8297
How to cache the response that was genereated by expressjs route. This route has a lot of database access and changes to it to it are very little. Is there any node module avaialble.
Thanks
Upvotes: 5
Views: 3556
Reputation: 5237
connect-cache should do the trick. Add this to your app as a middleware
var connect_cache = require('connect-cache');
app.use(
connect_cache({rules: [{regex: /.*/, ttl: 60000}]})
);
Upvotes: 4