0

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 2

2

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.

Sign up to request clarification or add additional context in comments.

8 Comments

yup i tried this one . my project has many components folder and images but when used npm run build i got build folder with only one index . i didnt get my components folders
Thats fine. your all components are bundled in one Js file inside build/static/js folder.
i see so now if i copy , paste inside the Apache webapp then if i run build folder it is it will work or still should i do some other configurations
hi Abhishek i found the issue and fixed ., the issue was just with Router path . now its working fine . great Abhishek thanks
@Ramusesan I have the same issue "blank page" how did u fix the Router path?
|
1

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':

this is how your tomcat webapps folder should look like:

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!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.