I have created react application using react+redux which has some API call its running fine with npm start on localhost:3000 . but i wanna to deploy onto Apache tomcat or any other server. is it possible .? if yes then tell how to do
2 Answers
Just run npm run build to make production build, then copy build folder and drop in public folder of your web server it will work.
Checkout official docs of Create react app on deployment for more details.
8 Comments
build/static/js folder.This will work on Tomcat 9.x:
As mentioned before, use npm run build to create the build artifacts (inside your app's 'build' folder).
Use hot deploy on tomcat: just copy the build folder to TOMCAT_HOME/webapps folder, and change the name to your app's name, e.g. 'your-app-here':
Browse to http://localhost:8080/your-app-here/
Note that the page might fail to load with error 404, due to missing static files (css, js etc.); in that case you will need to move the static folder from your-app to TOMCAT_HOME/webapps folder.
Reload the page or restart tomcat.
Goodluck!
