Skip to content

Instantly share code, notes, and snippets.

@Prosen-Ghosh
Created January 22, 2023 15:23
Show Gist options
  • Save Prosen-Ghosh/9a2d42e21143ffa41cbafbbb8c9e643a to your computer and use it in GitHub Desktop.
Save Prosen-Ghosh/9a2d42e21143ffa41cbafbbb8c9e643a to your computer and use it in GitHub Desktop.
const Redis = require("ioredis");
const redis = new Redis();
app.get("/top-articles", async (req, res) => {
const articles = await redis.zrevrange("articles", 0, 10);
res.send(articles.map(JSON.parse));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment