About an example from the book Pro AngularJS! Urgent help! ! ! !

  node.js, question

This book first let me start a service on localhost:5000, then start a server to store data on localhost:5500, and finally use the data on 5500 in the page under localhost:5000, but this nima is clearly cross-domain, and then there is no hint or explanation in the book. is the author sick? I’m afraid I will Cut Him Up!! ! !

Finally, please teach me how to solve it.

angular.module('sportsStrore').constant("dataUrl", "http://localhost:5500/products").controller('sportsStoreCtrl', function($scope, $http, dadaUrl){
 $scope.data = {};
 
 $http.get(dataUrl).success(function(data){
 $scope.data.product = data;
 });
 
 });

I don’t know how to add the header you asked me to add, because my requested server was started at the terminal in this way.

dpd create sportsstore
 dpd -p 5500 sportsstore/app.dpd
 dashboard

In this way, the requested service will pop up the management page, where to add it?

Take a look at this module cors on npm.cors