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) {