确保我的RESTful API在本地运行正常后,我按照以下指南中的说明进行部署: https://cloud.google.com/nodejs/getting-started/hello-world
......我相信我做对了。之后我得到了以下屏幕 gcloud app部署 跑完了。
可悲的是,https://_project-id.appspot.com(或命令行上的gcloud app浏览)一直导致502服务器错误:
错误:服务器错误
服务器遇到临时错误,无法完成您的请求。 请在30秒后再试一次。
(是的,我多次尝试过)
=============================================== ========= 编辑: 当我检查部署管理器时,它说: 您还没有任何部署。
的app.yaml
# Copyright 2015-2016, Google, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# [START runtime]
runtime: nodejs
env: flex
# [END runtime]
的package.json
{
"name": "plusfriend",
"version": "1.0.0",
"description": "Jjalkey Kakao Plus Friend/YellowID RESTful API",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"body-parser": "*",
"express": "4.14.1",
"mongoose": "4.8.1",
"gcloud": "^0.37.0"
},
"author": "Edward Joon-Hyuk Chang",
"license": "ISC"
}
server.js的最后一部分
// Listen
app.listen(80);
我应该做些什么? 非常感谢你提前。
答案 0 :(得分:0)
至于这个问题,我只是重组了一切。您可以在此处查看文件:https://github.com/edwardjhchang/Jjalkey-Kakao-Talk-Plus-Friend-Auto-Reply-API
最重要的是,您必须创建var http = require('http');
(我最初没有意识到)。检查我的存储库以获取更多详细信息:D