Node.js服务器返回html文件,而不是在云9中的JSON响应

我尝试在c9.io中开发 – 复制项目的结构:

\-C9ProjectName | +---Frontend | | | \---index.html - AngularJS app | \---Backend | \---server.js - Node.js server 

Server.js在env.IP和env.PORT上启动,并通过https使用Express。 Index.html通过$ http.get(' https://C9ProjectName.c9.io/api/method ')获取请求,但响应html文件:

 <title>Sign-in | Cloud9 IDE - Ajax.org</title> <meta name="description" content="Meet Cloud9, development-as-a-service for Javascripters and other developers"/> 

如果直接调用“ https://C9ProjectName.c9.io/api/method ” – 服务器用正常的JSON回答发送响应。

什么来自云9的HTML文件的返回?

看来你的工作空间是私人的。 如果您尝试通过代码访问工作区,则需要公开您的应用程序URL。 你可以点击IDE右上angular的“共享”,然后select“应用程序”url旁边的“公共”。