api-cache-mongoose
![GitHub issues](https://img.shields.io/github/issues/drkain/steam-market-search.svg)
What is this?*
api-cache-mongoose is an NPM package to easily cache API calls to a MongoDB database and update them after X minutes.
Install
npm install --save api-cache-mongoose
Usage
You will need to set up a mongoose connection. Check examples/database.js
var mongoose = require('mongoose');
var ApiCache = require("api-cache-mongoose")( mongoose );
ApiCache only receives two parameters, The target URL (String) and minutes between api calls (Number) default=5
app.get("/users", function(req, res){
ApiCache("https://jsonplaceholder.typicode.com/users", 30).then(function(response){
res.json(response);
}, function(err){
console.warn(err);
res.json({ success : false });
});
});
Additional Notes
- Please report any issues here