0

xhr.js:247          GET http://localhost:5173/api/products 404 (Not Found)
settle.js:19 Uncaught (in promise) AxiosError {message: 'Request failed with status code 404', name: 'AxiosError', code: 'ERR_BAD_REQUEST', config: {…}, request: XMLHttpRequest, …}

I get this error in the console I think i might be some problem here but im not quite sure.

Because I dont know if its the backend that won’t send the data or if its the frontend that won’t reccive it. Because if i got to http://localhost:5000/api/products where I the backend is I can se the data

import express from 'express';
import data from './data.js';
 const app = express();
// test
app.get('/api/products', (req, res) => {
  res.send(data.products);
});
 const port = process.env.PORT || 5000;
app.listen(port, () => {
  console.log(`serve at http://localhost:${port}`);
});

Lukas

lukas Johansson Asked question March 21, 2023