I have been trying to create an android app using nativescript.I am using fetch module to get response from my server.When I am trying to get response from httpbin.org/get ,it is OK.But when I am trying to get response from my local server,I am getting Network Request Failed. error.
Sending to httpbin.org/get-
return fetchModule.fetch("https://httpbin.org/get").then(response => { return response.text(); }).then(function (r) {
console.log(r);
}, function (e) {
console.log(e);
});
Sending to localhost:8000/api-
return fetchModule.fetch("http://localhost:8000/api").then(response => { return response.text(); }).then(function (r) {
console.log(r);
}, function (e) {
console.log(e);
});
When I try to get response from localhost:8000/api in pure node.js via the request module.It worked fine.But now,I don't to know how to solve this in nativescript using fetch module.