app.get('/api/product', (req, res) => {
const { sneakerName } = req.query;
console.log(req.query)
// Retrieve product details using "sneaks-api" package
sneaks.getProducts({sneakerName}, 10, function(err, products){
console.log(products)
})
});
const handleSearch = () => {
// Fetch the product information from the backend
axios.get(`http://localhost:8000/api/product?sneakerName=${sneakerName}`)
.then((response) => {
// Store the product information in the component's state
setProduct(response.data);
})
.catch((error) => {
console.log('Error:', error);
});
};
Error: Could not connect to StockX while searching '
at Object.getProductsAndInfo (/Users/tyler/Desktop/code/codingDojo/PA/sneakerverse/server/node_modules/sneaks-api/scrapers/stockx-scraper.js:62:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
null
Seems it is hanging on StockX and not searching the other website. It woks fine in my backend as per npm website instructions but I want to implement front end functionality