简体   繁体   English

在Google云中部署react app

[英]Deploying react app in google cloud

I have a react project code. 我有一个反应项目代码。 I want to deploy it on google cloud. 我想在谷歌云上部署它。 I have a build directory in my project which has builds. 我的项目中有一个构建目录。 Here is my project structure. 这是我的项目结构。 在此输入图像描述

How can I deploy it on google cloud. 如何在谷歌云上部署它。 Can someone please guide me. 有人可以指导我。 What all files from my project will I have to put there. 我必须把我项目中的所有文件放在那里。 I am very new to deploying apps online. 我很擅长在线部署应用程序。 Will I need to just put the build folder or will I need to upload complete project there? 我是否需要放置构建文件夹,还是需要上传完整的项目?

React apps are single page applications. React应用程序是单页面应用程序。 Single page applications (SPA) can be hosted as a static website on google cloud storage. 单页应用程序(SPA)可以作为谷歌云存储上的静态网站托管。 Here is the link for hosting a static website on GCP. 这是在GCP上托管静态网站的链接 Similarly, If you want to host reactJS app on AWS S3, here are the steps . 同样,如果您想在AWS S3上托管reactJS应用程序,请执行以下步骤

Host the index.html in the root folder of your bucket. 在您的存储桶的根文件夹中托管index.html Store your bundled react app.js file to sub folders and specify the path in index.html. 将捆绑的react app.js文件存储到子文件夹,并在index.html中指定路径。 You can also store other public assets in sub-folder hierarchy. 您还可以将其他公共资源存储在子文件夹层次结构中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM