【发布时间】:2016-09-09 03:54:15
【问题描述】:
我正在尝试了解 Compute Engine 的工作机制,以便在 Node.js 中编写一个在 Compute Engine 中运行的 WebSocket。为了做到这一点,我首先开始运行(npm start)示例 Hello World 项目并让它工作。然后,我尝试将 ".send("Hello World!")" 更改为 ".send("Hello World2!")" 并再次运行,但我得到了 "Hello World!"再次,即使我更改了源代码。当我尝试“git commit”时,我得到“你的分支是最新的”。然后在尝试“git pull”和“git push”之后,我仍然得到“Hello World!”作为输出。如何修改代码并使其运行修改后的代码?
Google 提供的 Hello World 示例代码
var express = require('express');
var app = express();
// [START hello_world]
// Say hello!
app.get('/', function (req, res) {
res.status(200).send('Hello, world!');
});
// [END hello_world]
if (module === require.main) {
// [START server]
// Start the server
var server = app.listen(process.env.PORT || 8080, function () {
var port = server.address().port;
console.log('App listening on port %s', port);
});
// [END server]
}
module.exports = app;
【问题讨论】:
标签: node.js git google-app-engine google-compute-engine google-cloud-platform