【发布时间】:2017-10-06 01:29:57
【问题描述】:
我正在尝试在 Google Cloud Platform、App Engine 上进行一些实际操作。
同样,我创建了一个简单的 nodejs 应用程序,它只是在响应中发送 Hello Wold 消息。
以下是我的文件:
aap.yaml
runtime: nodejs
env: flex
index.js
'use strict';
const http = require('http');
const port = 443;
const requestHandler = (request, response) => {
console.log(request.url);
response.end('Hello Node.js Server!');
}
const server = http.createServer(requestHandler);
server.listen(port, (err) => {
if (err) {
return console.log('something bad happened', err)
}
console.log(`server is listening on ${port}`)
});
package.json
{
"name": "test-pro-for-gcm",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js",
"deploy": "gcloud app deploy",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
更新 1
在 GCP 日志中,16:31:59.000 server is listening on 443
【问题讨论】:
-
嘿,自周六以来我一直遇到同样的错误。将在这里观看线程,希望我们能得到反馈。
-
我自己创建了这个应用程序,但遇到了错误。现在我正在部署 hello-world 演示应用程序,它按预期工作。您可以从这里下载演示 codeload.github.com/GoogleCloudPlatform/nodejs-docs-samples/zip/…
标签: node.js google-app-engine google-cloud-platform