The origin is the name of a
According to the CORS policy, images and objects can only be fetched from the same server from where the origin lies. It will make calls to the same origin.
No Access-Control-Header-Present error.
In your get request, add the following to the header in the app.get function:
You will also need to add the following to the response:
You can add the following code to your code to solve the issue:
const cors = require('cors'); app.use(cors());
You will, however, have to install CORS on your machine before you can use this. You can install it by running:
npm i cors
You can use CORS with express to resolve the issue as well. Add the following to your code:
const express = require('express') const app = express() app.use(cors())
View all Courses