So i have successfully set up https server in node on localhost. And it's working, but i have link from third party api, that i want to call and the display the data in front end. When i try to fetch it on front end i get No 'Access-Control-Allow-Origin' header is present on the requested resource. So i think i need to create https proxy for this. Thanks so much.
here is my node.js
var https = require('https');
var fs = require('fs');
var options = {
key: fs.readFileSync('key.pem'),
cert: fs.readFileSync('cert.pem')
};
var a = https.createServer(options, function (req, res) {
res.writeHead(200);
res.end("Nemke");
}).listen(8000);
And the link to the API https://api.kursna-lista.info/b7b80a59415046c33449b6a2a96bd4d8/kursna_lista
Now what I want to achieve is to:
fetch('https://localhost:8000/api.kursna-lista.info/b7b80a59415046c33449b6a2a96bd4d8/kursna_lista').then(res => res.json()).then(data => data).catch(err => err)