Created
March 30, 2018 19:26
-
-
Save bench/0e1695769fef39df8a4968ddc6f4ec42 to your computer and use it in GitHub Desktop.
Sample of GET /ALL - TP Redis - EPSI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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