从外部应用程序调用Bluemix服务

时间:2015-12-20 15:06:23

标签: ibm-cloud node-red ibm-watson

我使用translate serviceNode-Red构建了一个简单的Watson。直接从浏览器调用该服务即可,但是当我从CORS通过http调用服务时出现错误(Angular app)。

Bluemix是否允许CORS

提前致谢。

1 个答案:

答案 0 :(得分:1)

bluemix-settings.js 中添加这些代码行并重新启动应用

// The following property can be used to configure cross-origin resource sharing
    // in the HTTP nodes.
    // See https://github.com/troygoode/node-cors#configuration-options for
    // details on its contents. The following is a basic permissive set of options:
   httpNodeCors: {
      origin: "*",
     methods: "GET,PUT,POST,DELETE"
    },

在"之后添加此代码 functionGlobalContext:{},"