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);
}
});
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);
}
});
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);
}
});