React和Node App上的500错误Google App Engine

时间:2019-05-30 00:28:37

标签: google-app-engine

我遇到500错误,在localhost上一切正常。我认为这与我的YAML文件的设置或路由有关。

这是我的Yaml文件

env_variables:
  PROJECT_ID: 'staging'

service: poforms
env: standard
runtime: nodejs10

handlers:
  - url: /home

    secure: always
    redirect_http_response_code: 301
    script: auto


resources:
  cpu: 1
  memory_gb: 1.7
  disk_size_gb: 10
  volumes:
  - name: ramdisk1
    volume_type: tmpfs
    size_gb: 1

App.JS路由(反应)

onSubmit函数将axios请求调用到服务器

    axios
  .post("http://localhost:5000/home", data)
  .then(result => {
    console.log(result)
  })


Then I have a post request which holds my data.


app.post('/home', function (req, res) {

data

}

Server.js路由

app.post('/home', function (req, res) {

data

}

打包json文件

{
  "name": "client",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.2.0",
    "react-dom": "^16.2.0",
    "react-scripts": "1.0.17"
  },
  "scripts": {
    "start": "server.js",

    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject"
  },
  "proxy": "http://localhost:5000"
}

0 个答案:

没有答案