Node.js 应用程序引擎节点部署错误
我正在谷歌云平台上尝试一些实际操作,具体来说是应用引擎 同样,我创建了一个简单的nodejs应用程序,它只在响应中发送hellowld消息 但我无法访问端点并获得以下错误 以下是我的档案: aap.yamlNode.js 应用程序引擎节点部署错误,node.js,google-app-engine,google-cloud-platform,Node.js,Google App Engine,Google Cloud Platform,我正在谷歌云平台上尝试一些实际操作,具体来说是应用引擎 同样,我创建了一个简单的nodejs应用程序,它只在响应中发送hellowld消息 但我无法访问端点并获得以下错误 以下是我的档案: aap.yaml runtime: nodejs env: flex index.js 'use strict'; const http = require('http'); const port = 443; const requestHandler = (request, response) =&
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服务器正在侦听443
将接收HTTP请求的端口是8080
使用代码中的使其与应用程序引擎环境兼容:
const-port=process.env.port | | 443代码>接收HTTP请求的端口是8080
使用代码中的使其与应用程序引擎环境兼容:const-port=process.env.port | | 443代码>嘿,我从周六起就犯了同样的错误。将在这里观看线程,希望我们能得到反馈。我自己创建了这个应用程序,但出现了错误。现在,我正在部署hello world演示应用程序,它正在按预期工作。你可以从这里下载演示,嘿,我从周六开始就有同样的错误。将在这里观看线程,希望我们能得到反馈。我自己创建了这个应用程序,但出现了错误。现在,我正在部署hello world演示应用程序,它正在按预期工作。您可以从这里下载演示