This is the function i am using to get the preferred movie list from the mongodb.
function PreferedMovieData() {
var init_var = {method: 'POST',
mode: 'no-cors',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Access-Control-Allow-Origin': 'http://127.0.0.1:5001',
'Access-Control-Allow-Methods': 'POST',
'Access-Control-Allow-Headers': 'Content-Type'
},
body: JSON.stringify({"page_no": 1})
};
fetch("http://127.0.0.1:5001/prefered/movies_list", init_var).then(response => {
return response.text();
}).then(data => {
console.log(data)
});
}
PreferedMovieData();
i am getting the response back as undefined