Hi, so this is my fist post here.
I'm trying to learn how to do a site and i'm having problems using the API here the error i get:
Access to XMLHttpRequest at 'https://e621.net/post/index.json?tags=pokehidden&limit=3' from origin 'http://localhost:7000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I'm using a npm like this:
{
"name": "local_test",
"version": "1.0.0",
"description": "testing create site server",
"scripts": {
"prestart": "npm install",
"start": "http-server -a localhost -p 7000 -c-1 --cors"
},
"author": "Scottibr",
"license": "ISC",
"dependencies": {
"express": "*",
"cors": "*",
"http-server": "^0.11.1"
}
}
And my code is this simple one:
<!DOCTYPE html>
<html>
<head>
<meta User-Agent: MyProject/ 1.0 (by Sstalker on e621, learning to make sites etc) >
<meta Access-Control-Allow-Origin: * >
<meta charset="utf-8">
<title>JSON get external, test</title>
</head>
<body>
<script>
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if(this.readyState == 4 && this.status == 200){
console.log(xhttp.responseText);
}
};
xhttp.open("GET", "https://e621.net/post/index.json?tags=pokehidden&limit=3", true);
xhttp.send();
</script>
</body>
</html>
Updated