我使用translate service
和Node-Red
构建了一个简单的Watson
。直接从浏览器调用该服务即可,但是当我从CORS
通过http
调用服务时出现错误(Angular app
)。
Bluemix
是否允许CORS
?
提前致谢。
答案 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:{},"