I need to know what can I do to solve this problem, which need repair. I do not need to know the problem, need to know the solution. Anyone know how can I do?
my ionic app :
// controller test:
$http({
method: 'GET',
url: 'https://example.herokuapp.com/apiDataTest/'
}).then(function successCallback(response) {
console.log('response'+response);
}, function errorCallback(response) {
console.log('response'+response);
});
my api use express, is this:
var express = require('express');
var app = express();
app.get('/apiDataTest', getData);
function getData(req, res) {
res.json({
message: 'Ok! Welcome to test data!'
});
}
if I call the address by the browser or postman, for example. the json and returned as I need, but if you make the request in is not possible AngularJS due to error 'Access-Control-Allow-Headers'. I saw some questions about it, but did not realize the solution itself, does anyone know where (client or api) and how can I fix to solve?