无法使用聚合物铁AJAX调用我的Express后端中间件应用程序



我是聚合物和Express的新手呼唤各种事件示例ajax调用是

   <iron-ajax
   id="ajax"
 url="https://web-ui-hello.run.aws-usw02-pr.ice.predix.io/web/ui/api/getMapData"
 params='{"type":"all"}'
 handle-as="json"
 content-type="application/json"
 method="GET"
 on-response="helloResponse"
 debounce-duration="3000">

这个ajax调用在后端访问我的微服务是

 app.get ('/web/ui/api/getMapData',function(req,res){
 console.log('inside map');
  });

任何人都可以在这方面提供帮助,我被困在这方面试图弄清楚为什么它没有达到express?

据我了解,您的Express应用程序是中间件需要操纵发送给Predix的请求/响应。

因此,代替您的Web客户端,直接调用Predix API,更改您的客户端代码以向您自己的服务器提出请求。更改请求(如果有),然后启动从服务器到Predix的新请求。获取此新请求的响应,并将其更改(如果有)。该新响应应作为您的原始请求发送从Web客户端发送。

WebClient ----(REQ1) -> ExpressServer ---(REQ2)---> predix

webclient&lt; ---(res1)--- expresserver&lt; - (res2)---- predix