Still getting CORS error in chrome after adding headers in node express server : I'm trying to do a simple GET request to an XML file, and I'm stuck on this CORS error. I've tried multiple solutions including adding the headers manually in my server.js file, and using the cors npm package. With both of those, If i hit the endpoint in postman, i can see the headers attached to the request, as well as the response. However in google chrome the headers are not being attached to the request. here's the code in my index.html file 

    <body>
    <h1>test</h1>
    <script src="https://code.jquery.com/jquery-3.3.1.js" integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60=" crossorigin="anonymous"></script>
    <!-- <script src="./server.js"></script>  -->
    <script>
 
        var xhr = new XMLHttpRequest();
        xhr.open('GET',xmlRemoteUrl, true);
        xhr.withCredentials = true;
        xhr.send(null);

    </script>
</body>
note that i've hidden the url, but the variable xmlRemoteUrl contains the link to the xml page i'm trying to get information from. 

here's the code in my server.js file 

    
    var express = require("express");
    var bodyParser = require("body-parser");
    var path = require("path");
     //var cors = require('cors')
    // Sets up the Express App
    var app = express();
    
    
    var PORT = 3000;
    //app.use(cors())
    
    // Sets up the Express app to handle data parsing
    app.use(bodyParser.urlencoded({ extended: true }));
    app.use(bodyParser.json());
    
    // Routes
    app.get("/test", function(req, res) {
        res.set({
            'Access-Control-Allow-Origin': ['*'],
            'Access-Control-Allow-Methods': 'GET,PUT,POST,DELETE',
            'Access-Control-Allow-Headers': 'Content-Type'
         });
        res.sendFile(path.join(__dirname, "./index.html"));
         console.log('hit me')
         console.log(res);
    });
    
    app.get("/", function(req, res) {
        res.send('fuckkkkkkkkkkkkk')
    });
    
    // Starts the server to begin listening
    app.listen(PORT, function() {
      console.log("App listening on PORT " + PORT);
    });

