无法在 Cloud 9 中获取 Node.js 表示 'Hello World' 的代码

Can't get Node.js Express code to say 'Hello World' in Cloud 9

一直在试验 Cloud 9 并尝试使用 Express website in order to get 'Hello World!'. I tried listening to several different ports/ip referring to https://docs.c9.io/docs/run-an-application and Running Hello World using Node js Express in cloud 9IDE 中的示例代码。虽然侦听器会 运行,但它永远不会关闭或 return 之后的任何东西。有谁知道为什么会这样?这是我的代码:

var express = require('express');
var app = express();

app.get('/', function (req, res) {
  res.send('Hello World!');
});

app.listen(process.env.PORT, process.env.IP, function(){
    console.log('LISTENING');
});

您应该在编辑器中 运行 来自 c9 命令的 app.js,就在下方。 Cloud9 有自己的默认路径 运行。默认值:

https://helloexpress-abcd.c9.io/

helloexpress是你定义的项目名,你的情况不一样,

abcd is the username and the rest are the defaults

这应该显示 Hello World