So I have a P5JS app which has a very simple preload function:
function preload() {
json = loadJSON(getCurrentViewersUrl());
}
which calls this function and returns the request url:
function getCurrentViewersUrl() {
return "https://tmi.twitch.tv/group/user/" + STREAM_NAME + "/chatters";
}
This all worked swimingly when using http-server
to start my P5JS app.
I've now just switched so that my P5JS code is served up by my node app.
const express = require('express');
var app = express();
var server = app.listen(9999);
app.use(express.static('public'));
But now, with making this change I'm now getting the cors policy error:
Access to fetch at
'https://tmi.twitch.tv/group/user/x/chatters' from origin 'http://localhost:9999' has been blocked by CORS policy: No
'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
My question is, why am I getting this now and not before?