Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

express search query

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: #express #search #query
ADD COMMENT
Topic
Name
9+4 =