I can't get Repl.it to pull json from github. Do I need the api or just a better url?
Errors:
- While using the url https://raw.githubusercontent.com/Xiija/FakeDB/master/db.json
TypeError: NetworkError when attempting to fetch resource.
- While using this url Xiija.github.io/JSON/db.json
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data.
But, when I add https to it https://Xiija.github.io/JSON/db.json
TypeError: NetworkError when attempting to fetch resource.
The request
const myHeaders = new Headers({
'Content-Type': 'application/json', // text/xml .. application/json
'Access-Control-Allow-Headers': '*',
'accept': 'application/vnd.github.v3.raw',
'user-agent': 'dataApi'
});
let tm = new Date().getTime();
const myRequest = new Request(url + '?time=' + tm, {
method: 'GET',
rejectUnauthorized: false,
insecureHTTPParser: true,
mode: 'cors',
cache: 'default',
headers: myHeaders,
});