Skip to content

Instantly share code, notes, and snippets.

@bench
Created March 30, 2018 19:26
Show Gist options
  • Save bench/0e1695769fef39df8a4968ddc6f4ec42 to your computer and use it in GitHub Desktop.
Save bench/0e1695769fef39df8a4968ddc6f4ec42 to your computer and use it in GitHub Desktop.
Sample of GET /ALL - TP Redis - EPSI
const getAsync = util.promisify(client.get).bind(client);
const keysAsync = util.promisify(client.keys).bind(client);
app.get('/notes', async function (req, res, next) {
var promises = [];
await keysAsync('*').then(function (keys) {
console.log("got "+ keys)
keys.forEach(function (key) {
console.log(key);
promises.push(getAsync(key));
});
});
Promise.all(promises).then(function (notes) {
res.send(notes);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment