Search code examples
javascriptangularjsnode.jscloud9-ide

Node.js server return html file instead json response in cloud9


I try to develop in c9.io - copied project with structure:

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

Server.js started on env.IP and env.PORT and use Express by https. Index.html get request by $http.get('https://C9ProjectName.c9.io/api/method') but response html file:

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

If call 'https://C9ProjectName.c9.io/api/method' directly - server sends response with normal JSON answer.

What brings to return of html file from Cloud 9?


Solution

  • It seems your workspace is private. If you're trying to access your workspace via your code, you will need to make your Application URL public. You can do that by clicking on 'Share' near the top right of the IDE and then checking 'Public' next to the 'Application' url.