Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

add search query in express

app.get('/users', (req, res) => {
    if (req.query.name) {
        const search = req.query.name.toLowerCase();
        const matched = users.filter(user => user.email.toLowerCase().includes(search));
        res.send(matched);
    }
    else {
        res.send(users);
    }
});
 
PREVIOUS NEXT
Tagged: #add #search #query #express
ADD COMMENT
Topic
Name
1+8 =