How to connect to the process running on 'localhost' that is inside of cloud9 server

后端 未结 5 1296
既然无缘
既然无缘 2021-01-02 09:58

I have a Javascript project that I work on in cloud9 IDE online, and I wanted to test my code using testem npm module: npmjs.org/package/te

相关标签:
5条回答
  • 2021-01-02 10:05

    sorry for that, you can't!

    Available ports on a hosted Cloud9 workspace

    If you're developing a server application, please note that you need to listen to 0.0.0.0 ($IP) and 8080 ($PORT). Listening to this port will enable your app to be viewable at http://-.c9users.io

    You can also bind to ports 8081, and 8082, which can be accessed by http://-.c9users.io:8081 and http://-.c9users.io:8082 respectively.

    Please note that 8080, 8081, and 8082 are the only available ports on a hosted Cloud9 workspace.

    https://docs.c9.io/docs/run-an-application

    0 讨论(0)
  • 2021-01-02 10:06

    If you run testem with the host and port variables:

    testem --host $IP -p $PORT
    

    You should be able to connect from your browser by going to the root of your external server:

    http://workspace.username.c9users.io/
    
    0 讨论(0)
  • 2021-01-02 10:20

    on C9.io its simple for me.

    Just open the file(i.e server.js or index.js or index.html) and click on preview button.

    WAO you are done. :)

    hope it help.

    I created an application using node + express + react and then i created a simple server.js and click the preview, it open the browser.

    0 讨论(0)
  • 2021-01-02 10:22

    If you are running a node process: http://workspacename.username.c9users.io will be the link to get to it.

    If you want to preview a particular file in the workspace: https://c9users.io/username/workspacename/workspace/filename.html

    Example:

    My name is bob, and my project name is mycoolproject.

    Running node service link - http://mycoolproject.bob.c9users.io

    Direct file preview link - https://c9users.io/bob/mycoolproject/workspace/index.html

    0 讨论(0)
  • 2021-01-02 10:23

    I know this is a really late response, but I get the feeling that you simply just need the right hostname and you'll be in business. My method for getting C9's hostname is as follows:

    If you open up a terminal and access the mysql command line by typing in

    mysql-ctl start

    followed by

    mysql-ctl cli

    which will take you to the MySQL command line interface, and then you can run this query:

    SHOW VARIABLES WHERE Variable_name = 'hostname';

    It will give you back your hostname under the column hostname which should look something like this:

    yourUsername-yourProjectName-XXXXXXX

    where the X's form a 7 digit number. You can use that as your hostname instead of localhost or 127.0.0.1 (which have never worked for most people and I'm not sure why people on other SO posts consistently suggest those). I have used this hostname before to sync my PHP scripts with my MySQL databases (before C9 implemented a built-in phpMyAdmin), and always had success with it.

    0 讨论(0)
提交回复
热议问题