Skip to content

Error: Could not connect to StockX while searching #6

Description

@tylerwertman

server.js:

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

react component:

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

console.log in server:

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions