Going on with our project and fronting the front end part. We introduced the last definition here the definition of course. So of course, is defined as a cross origin resource sharing, and is a mechanism that uses additional HTTP headers to tell a browser to let a web application running a terminal region domain, have permission to access select your resources from a server at a different region. So what exactly is a cross region HTTP request? a web application makes a cross region HTTP request when it requests a resource that has a different region than its own region and pay attention because it's not only a different domain or different protocol, but even a different port is considered across the region HTTP requests. This is why we are going to have the same problem in our front end web application.
If we don't handle course correctly, we are going to have an error, an error message similar to the one I'm showing here. So, this is what will happen if we request if we perform a GET requests for our articles list to handle course, we are going to use the course node module. The course not the module is a Node JS package for providing our express in our case middleware that can be used to enable course with various options at our our front end domain, to be whitelisted and pass the course the course problems So, we are going to define our front end URL in the URL in our EMB file. So let's say that our, our front end URL will be localhost on port 3000. So, we just go in our config and we define our course whitelist as process dot BMP dot from the URL.
Now you're ready to import course module and we have to create a course of course options in order to say which one is our region. So for us config dot course whitelist. Now we have to for our URL, our GET requests that we want to use these course options. Before fronting the POST requests, we need to understand why we need to enable course pre flight. We are now going to see the details but certain course requests are considered complex, complex and require an initial options request that is called the preflight request. So, putting into practice, you're going to go back to our past functions and we add an options up the options just Before the past definition, so we just do this and we did the same for both chase