Before proceeding with the necessary changes in our backend, let's talk about a very important and also very common subject in today's modern web applications, known as CORS.
When we use XMLHttpRequest or the Fetch API to get data from a given server, this call is usually performed from another application, and from somewhere else.
For security reasons, browsers restrict cross-origin HTTP requests.
A simple example to understand how CORS works is this: imagine that a frontend application running in a particular domain, for example, http://mysimpledomain.com, sends a request to another application in another domain called http://myanothersimpledomain.com.
CORS is a mechanism that uses additional HTTP headers to tell a browser to let a web application run at one origin, http://mysimpledomain.com, and have permissions to access selected...