I have simple create-react-app
on AWS EC2, I want to deploy my React app to AWS EC2 instance which I have already created and one of my Django application is running on it using gunicorn and nginx.
Now I want to deploy a react application to that ec2 instance and host the react app with another subdomain here. This react app requires to call APIs hosted to a different EC2 instance.
When I do npm run build
, it creates a build folder there and when i run serve -s build
my webpage opens but API is not called.
So, what I want to achieve is:
- Make API run to the react application in production with axios.
- Correctly deploy React app to EC2 instance.
Kindly suggest how to achieve this?