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

a 夏天 提交于 2019-11-30 13:47:26
Kendell

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

msrxthr

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/

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.

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.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!