all the app apis work fine on the local machines, but after pushed to cloud foundry all the api return 502 Bad Gateway: Registered endpoint failed to handle the request.
app is built on Node.js use the javascript to call the local json file and Express api, some of the code call json files as below:
function get_json(){ $.ajax({ dataType: "json", url: 'json/export.json', success: parse_json }); }
$http.get('json/risk_file.json')
.success(function(data) {
$scope.webData = data;
console.log(data);
})
.error(function(error) {
console.log('Error: ' + error);
});
Answer by Greg Stroup · Oct 27, 2015 at 05:13 PM
That looks like it should work. A few things to look at:
Make sure the risk_file.json is included in your "dist" build, and deployed to cloud foundry
Try the "json/risk_file.json" URL directly in your browser to make sure it loads.
Try a leading slash to make the path absolute: "/json/risk_file.json"