Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query parameter does not working #1519

Open
PradipDesigner opened this issue Feb 20, 2024 · 3 comments
Open

query parameter does not working #1519

PradipDesigner opened this issue Feb 20, 2024 · 3 comments

Comments

@PradipDesigner
Copy link

i try many times this "http://localhost:3000/Products?q=mobile" but this not working so anyone pls help
and my db.json file this
"Products": [
{
"productName": "Boat ",
"price": "2999",
"color": "black",
"category": "watch",
"description": "good watch for personal use",
"productUrl": "https://images-na.ssl-images-amazon.com/images/I/418liDrUObL.SX320_QL100_AC_SCLZZZZZZZ.jpg",
"id": "4169"
},
{
"id": "be25",
"productName": "iphone 15",
"price": "79999",
"color": "white",
"category": "mobile",
"description": "good smart mobile",
"productUrl": "https://m.media-amazon.com/images/W/MEDIAX_849526-T2/images/I/71PjpS59XLL.AC_SR360,240_QL70.jpg"
},
{
"productName": "samsung galaxy",
"price": "2000",
"color": "green",
"category": "mobile",
"description": "good mobile phone",
"productUrl": "https://m.media-amazon.com/images/W/MEDIAX_849526-T2/images/I/818VqDSKpCL.AC_UY436_FMwebp_QL65.jpg",
"id": "fe0b"
}
]

@arcodes-real
Copy link

app.get('/Products', (req, res) => {
const query = req.query.q;
if (!query) {
res.status(400).send('Missing query parameter');
return;
}

fs.readFile('db.json', 'utf8', (err, data) => {
if (err) {
console.error(err);
res.status(500).send('Internal Server Error');
return;
}
make sure you have this code structured properly

@rafaelborges26
Copy link

it seems that is not available in this version but i cant use in another version too..

@fernandortec
Copy link

I had this issue too, I downgraded to 0.17.4 and it worked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants