From origin 'null' has been blocked by CORS policy: Cross origin requests error

You can use a CORS proxy but that isn’t meant for production.


Create a simple Express server on something like Replit/Glitch or some other free hosting site. Add the cors package and serve the JSON yourself. Then import the JSON from that endpoint.

Simple Express app
const express = require('express');
const app = express();
const cors = require('cors');

app.use(cors());

app.get("/", (req, res) => {
  return res.json([
    { day: "mon", amount: 17.45 },
    { day: "tue", amount: 34.91 },
    { day: "wed", amount: 52.36 },
    { day: "thu", amount: 31.07 },
    { day: "fri", amount: 23.39 },
    { day: "sat", amount: 43.28 },
    { day: "sun", amount: 25.48 },
  ]);
});

app.listen(3000);
1 Like