NodeJS, how do I implement cors functionality

I am currently trying to implement the LinkedIn API into my node website, and I am running into an issue where I get a ‘cors’ error

I have tried using the npm cors library, such as:

app.options('*', cors())

Though nothing is working, I just keep getting the error ‘CORS Missing Allow Origin’. I have tried everything, used Google, asked friends. I have no idea what I am doing wrong?

This is how I am fetching stuff (everything is on http://localhost:3000):

// runs this script after LinkedIn API redirects back to my site.
    window.onload = function() {
        const queryString =
        const urlParams = new URLSearchParams(queryString)
        const page_type = urlParams.get("code")
        console.log('queryString: ' + queryString)
        console.log('urlParams: ' + urlParams)
        console.log('page_type: ' + page_type)
        try {
            const res = fetch(''+page_type, {
                method: 'POST',
                host: '',
                headers: {'Content-Type': 'x-www-form-urlencoded'}
        } catch (err) {

CORS is something you have to implement on the server-side. In your case, LinkedIn has to do that or respectively allow requests from your domain and then they will a CORS response header your browser is reading.
If this response header is missing, your browser will block the response.

You aren’t using the official api!
If I google ‘linkedin api’ the very first result is this Developers | LinkedIn
Where you even get greeted with multiple links to guides on how to get an access token. They even include samples.

Start reading the docs.