我正在尝试将我的 React express 应用程序部署到 Google 云应用程序引擎,但目前出现 404 状态错误:
加载资源失败:服务器响应状态为 404()
以及页面上的无法获取 / 。
在我的本地主机上一切正常,只是当我将它部署到谷歌云时,我收到了这个错误。
我的谷歌控制台日志还说:Hello from .get /home undefined undefined undefined
所以
这是我的 yaml 文件:
service: web-form
runtime: nodejs
env: flex
automatic_scaling:
min_num_instances: 1
max_num_instances: 1
env_variables:
PROJECT_ID: 'staging'
handlers:
- url: /*
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
Run Code Online (Sandbox Code Playgroud)
应用程序.js:
import React, { Component } from "react";
import PageOne from "./components/PageOne";
import PageTwo from "./components/PageTwo"; …Run Code Online (Sandbox Code Playgroud)