user10224616
user10224616

Reputation:

Deploying ReactJs app in my machine through localhost

I create a reactJs App. But for now I run this app through Intellij idea and I would like to deploy it and run permanently in my machine without turning on through Intellij idea. How I could deploy react app and run it as deployment in my machine

Upvotes: 0

Views: 1143

Answers (2)

Yuri Fedotov
Yuri Fedotov

Reputation: 161

If you created your app with create-react-app, you should be able to start local development server from the command line. To do this, open you project's root directory in the terminal and type npm start.

If you would like to create and serve a production bundle, you should build your project with npm run build and then serve build directory with a web server. The easiest way to do this is install serve via npm (npm install -g serve) and run serve -s build

Upvotes: 2

Nallamachu
Nallamachu

Reputation: 1488

For this purpose only webservers available like Tomcat, Payara, Whildfly, etc. You can install any one of those servers and deploy your application into that. As on when you started the server your application will be accessible.

Approach 1:

You can set up the server into your IDE and simply run the project on server mode.

Approach 2:

By using your project code, create a war file with the help of any build tool like MAVEN/GRADLE, etc. Then login into the server manager(Tomcat Manager) and deploy the generated .war file in deployment section.

Note: With the 2nd approach, you can access the application as on when you start the server.

Upvotes: 0

Related Questions