node app.js
とコマンドを打つと、何も表示されないまま止まってしまいます。
ターミナルのフォアグラウンドで実行されているなら、それで正常だと思います。
3000番は使えなかったと認識しています。
Run an Application · Cloud9
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://<workspacename>-<username>.c9users.io
You can also bind to ports 8081, and 8082, which can be accessed by http://<workspacename>-<username>.c9users.io:8081 and http://<workspacename>-<username>.c9users.io:8082 respectively.
Please note that 8080, 8081, and 8082 are the only available ports on a hosted Cloud9 workspace.
以下にて動作を確認しました。
javascript
1var http = require('http');
2var server = http.createServer(function(req, res) {
3 res.writeHead(200, {'Content-Type': 'text/plain'});
4 res.write('Hello Wrold\n');
5 res.end();
6});
7server.listen(8082);
8
9console.log('Server running at http://127.0.0.1:8082');
動作確認は別のターミナルからcurl
コマンドでも使ってみてください。
もちろんブラウザからでも出来ます。
xxx:~/workspace $ curl ワークスペース名-アカウント名.c9users.io:8082/
Hello Wrold
xxx:~/workspace $ curl 127.0.0.1:8082/
Hello Wrold
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/08/23 17:03