Skip to content

Commit

Permalink
Updated for modern versions of Node Redis
Browse files Browse the repository at this point in the history
  • Loading branch information
guyroyse authored Jul 17, 2023
1 parent 3531987 commit 133e525
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions examples/search/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,20 @@ app.use(express.static(path.join(__dirname, 'public')));

// populate search

db.sadd('ferret', 'tobi');
db.sadd('ferret', 'loki');
db.sadd('ferret', 'jane');
db.sadd('cat', 'manny');
db.sadd('cat', 'luna');
db.sAdd('ferret', 'tobi');
db.sAdd('ferret', 'loki');
db.sAdd('ferret', 'jane');
db.sAdd('cat', 'manny');
db.sAdd('cat', 'luna');

/**
* GET search for :query.
*/

app.get('/search/:query?', function(req, res){
app.get('/search/:query?', async function(req, res){
var query = req.params.query;
db.smembers(query, function(err, vals){
if (err) return res.send(500);
res.send(vals);
});
const vals = await db.sMembers(query);
res.send(vals);
});

/**
Expand Down

0 comments on commit 133e525

Please sign in to comment.