Blocked by CORS Policy

Cing Sian Dal
Mar 12, 2021

Have you tried this?

const app = express();
app.use(cors());

Yeah. You have seen this solution commonly.

Then, have you tried this in your request query?

axios.get('http:localhost:7000/items')

I mean http.

If you are specifying url in .env like this, instead of this:

REACT_APP_API_URL=localhost:7000

Always add http or https if SSL enabled.

REACT_APP_API_URL=http:localhost:7000

--

--

Cing Sian Dal

Don’t follow me. I wrote junks here. Follow me on Twitter instead.