Reputation: 9095
I am trying to host a view, I have build the application using create react app, so I don't have any back end for the application. I am just consuming the services.
I have fair idea of using Node and React with Docker and exposing a single port and serving the html file through Node.js.
But in this sample application I am just consuming the services and rendering the UI.
For this sample UI do we need to use Docker, I have read through some docs and found out that its better host this single html file in s3, since AWS S3 is made for file retrieving and hosting.
So how can I build the application and how can host this application?
Upvotes: 2
Views: 1391
Reputation: 942
To build the application run the command npm run build
, this will be preconfigure if you are using create-react-app for your application setup.
For deployment go to your AWS console,
I would suggest using cloudfront on top of the s3 bucket.
Read this blog for more details,
Upvotes: 2
Reputation: 405
I suggest you take a look at firebase (https://firebase.google.com/docs/hosting). Firebase is very easy to setup with your react app.
Once setup you run npm run-script build
to build for production and then do firebase deploy
and you're done!
P.S: Firebase also works well with node.js backends if you had one.
Upvotes: 1
Reputation: 650
If you want to host this react app on AWS S3, you can compile the code using npm run build
or yarn build
Building production build. It should create a build folder with all the production ready files. You then need to upload these files to S3 bucket, which you want to host your website. After this website should be available at url associated with S3 bucket
Here is the documentation for S3 hosting static website
Upvotes: 2