I have a web server, which has API.I used Postman to create POST and Get requests, and all worked fine. Now I've started to write a front-end app, and I cannot make a post request from browser. When I run index.html from my computer, I get this Error: "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://localhost:3000/python. Reason: CORS header 'Access-Control-Allow-Origin' missing". Here is my code:
async function createRes(){
try { const connect = await fetch ('http://127.0.0.1:3000/python',
{method:"POST",
body:JSON.stringify({date:"01/02/2019"}),
headers:{"Content-Type":"application/json",
"Access-Control-Allow-Origin":"*"
},
credentials:"include"})
const data = await connect.json();
} catch(error){
console.log(error.message)}
}