Cross-Origin Resource Sharing (CORS) is a mechanism that uses additional HTTP headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin.
A web application executes a cross-origin HTTP request when it requests a resource that has a different origin (domain, protocol, or port) from its own.
More details on CORS can be found here.
Most noobs, who are starting with Back-End development, will often see this error.
The first step would be to use the CORS package, when working with NPM.
//Install npm i cors //In index.js file, var cors = require('cors'); app.use('cors');
Some deployments may still cause the CORS error in some cases, wherein this particular Chrome extension comes handy.
You just have to Enable and save, and it should solve the CORS error for you.
However, do note that some sites, usually third party API services, such as Newsapi restrict only localhost sites to be able to access their free plan APIs, and will block access requests from deployed websites.
Cheers! Have a CORS-Free day!