how to deploy react app in tomcat server
JavaScript
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.frugalis</groupId>
<artifactId>Frugalis</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<npm.output.directory>build</npm.output.directory>
</properties>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<webResources>
<resource>
<directory>${npm.output.directory}</directory>
</resource>
</webResources>
<webXml>${basedir}/web.xml</webXml>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<id>npm run build (compile)</id>
<goals>
<goal>exec</goal>
</goals>
<phase>compile</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>run</argument>
<argument>build</argument>
</arguments>
</configuration>
</execution>
</executions>
<configuration>
<environmentVariables>
<CI>false</CI>
<!-- The following parameters create an NPM sandbox for CI -->
<NPM_CONFIG_PREFIX>${basedir}/npm</NPM_CONFIG_PREFIX>
<NPM_CONFIG_CACHE>${NPM_CONFIG_PREFIX}/cache</NPM_CONFIG_CACHE>
<NPM_CONFIG_TMP>${project.build.directory}/npmtmp</NPM_CONFIG_TMP>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<environmentVariables>
<PUBLIC_URL>http://localhost:8080/${project.artifactId}</PUBLIC_URL>
<REACT_APP_ROUTER_BASE>/${project.artifactId}</REACT_APP_ROUTER_BASE>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>prod</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<environmentVariables>
<PUBLIC_URL>http://frugalisminds.com/${project.artifactId}</PUBLIC_URL>
<REACT_APP_ROUTER_BASE>/${project.artifactId}</REACT_APP_ROUTER_BASE>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
</span>
import React, { Component } from 'react';
import {
BrowserRouter,
Link,
Route,
Switch
} from 'react-router-dom';
import Home from './Home.jsx';
import ContactUs from './ContactUs.jsx';
import Blog from './Blog.jsx';
class App extends Component {
render() {
return (
<div className="App">
<div className="App-header">
<h2>Welcome to React</h2>
</div>
<BrowserRouter basename={process.env.REACT_APP_ROUTER_BASE || ''}>
<div>
<ul className="nav">
<li><Link to="/">Home</Link></li>
<li><Link to="/blog">Blog</Link></li>
<li><Link to="/contactUs">Contact Us</Link></li>
</ul>
<Switch>
<Route path="/blog" component={Blog}/>
<Route path="/contactUs" component={ContactUs}/>
<Route path="/" component={Home}/>
</Switch>
</div>
</BrowserRouter>
</div>
);
}
}
export default App;
<span style="font-family: helvetica, arial, sans-serif;"><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.frugalis</groupId>
<artifactId>Frugalis</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<npm.output.directory>build</npm.output.directory>
</properties>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<webResources>
<resource>
<directory>${npm.output.directory}</directory>
</resource>
</webResources>
<webXml>${basedir}/web.xml</webXml>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3.2</version>
<executions>
<execution>
<id>npm run build (compile)</id>
<goals>
<goal>exec</goal>
</goals>
<phase>compile</phase>
<configuration>
<executable>npm</executable>
<arguments>
<argument>run</argument>
<argument>build</argument>
</arguments>
</configuration>
</execution>
</executions>
<configuration>
<environmentVariables>
<CI>false</CI>
<!-- The following parameters create an NPM sandbox for CI -->
<NPM_CONFIG_PREFIX>${basedir}/npm</NPM_CONFIG_PREFIX>
<NPM_CONFIG_CACHE>${NPM_CONFIG_PREFIX}/cache</NPM_CONFIG_CACHE>
<NPM_CONFIG_TMP>${project.build.directory}/npmtmp</NPM_CONFIG_TMP>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<environmentVariables>
<PUBLIC_URL>http://localhost:8080/${project.artifactId}</PUBLIC_URL>
<REACT_APP_ROUTER_BASE>/${project.artifactId}</REACT_APP_ROUTER_BASE>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>prod</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<environmentVariables>
<PUBLIC_URL>http://frugalisminds.com/${project.artifactId}</PUBLIC_URL>
<REACT_APP_ROUTER_BASE>/${project.artifactId}</REACT_APP_ROUTER_BASE>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
</span>
<span style="font-family: helvetica, arial, sans-serif;">{
"name": "App",
"version": "0.1.0",
"homepage":"http://localhost:8080/sampleapp",
"private": true,
"dependencies": {
"react": "^16.3.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}</span>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<display-name>frugalis</display-name>
<error-page>
<error-code>404</error-code>
<location>/index.html</location>
</error-page>
</web-app>
Also in JavaScript:
- Title
- disable yellow box react native
- Category
- JavaScript
- Title
- async await anonymous function
- Category
- JavaScript
- Title
- href before onclick js
- Category
- JavaScript
- Title
- how to draw a triangle using javascript
- Category
- JavaScript
- Title
- compress string javascript
- Category
- JavaScript
- Title
- google sign in in firebase react
- Category
- JavaScript
- Title
- how to create uuid in javascript
- Category
- JavaScript
- Title
- angular event emitter
- Category
- JavaScript
- Title
- find last element with class jquery
- Category
- JavaScript
- Title
- how to make a proxy server node.js
- Category
- JavaScript
- Title
- canvas container page offset
- Category
- JavaScript
- Title
- function clear() p5js how das this work
- Category
- JavaScript
- Title
- create bottom navigation bar react native
- Category
- JavaScript
- Title
- format date javascript
- Category
- JavaScript
- Title
- get query string javascript nodejs
- Category
- JavaScript
- Title
- how to Fetch the index of table row using jquery
- Category
- JavaScript
- Title
- javascript change image src
- Category
- JavaScript
- Title
- add dynamic value to id attribute in angular 8
- Category
- JavaScript
- Title
- get youtube video id from url javascript
- Category
- JavaScript
- Title
- accept 2 values after decimal in angular forms
- Category
- JavaScript
- Title
- how to version a react app azure pipelines
- Category
- JavaScript
- Title
- javascript Check if an element is a descendant of another
- Category
- JavaScript
- Title
- brute force search javascript
- Category
- JavaScript
- Title
- delete all childs in node
- Category
- JavaScript
- Title
- foreach object javascript
- Category
- JavaScript
- Title
- Angular watching for changes in $http.pendingRequests from directive
- Category
- JavaScript
- Title
- if str contains jquery
- Category
- JavaScript
- Title
- how to make fake binary
- Category
- JavaScript
- Title
- javascript change meta tag
- Category
- JavaScript
- Title
- d3js circle out of scrren
- Category
- JavaScript
- Title
- how to appendChild in the begin of the div javascript
- Category
- JavaScript
- Title
- flutter cache json
- Category
- JavaScript
- Title
- eslint ignore javascript
- Category
- JavaScript
- Title
- eval in js
- Category
- JavaScript
- Title
- deparam javascript
- Category
- JavaScript
- Title
- How to pass a map from controller to javascript function in VF page
- Category
- JavaScript
- Title
- clone an object in javascript
- Category
- JavaScript
- Title
- javascript ajax request
- Category
- JavaScript
- Title
- javascript change attribute
- Category
- JavaScript
- Title
- find intersection between two object arrays javascript
- Category
- JavaScript
- Title
- chart.js label word wrap
- Category
- JavaScript
- Title
- add to classlist javascript
- Category
- JavaScript
- Title
- create csv file javascript
- Category
- JavaScript
- Title
- How to get row index and cellindex together in javascript
- Category
- JavaScript
- Title
- generate bearer token
- Category
- JavaScript
- Title
- get keys wher value is true in object in javascript
- Category
- JavaScript
- Title
- change src of iframe jquery
- Category
- JavaScript
- Title
- ajax laravel get data
- Category
- JavaScript
- Title
- fix your timestep javascript
- Category
- JavaScript
- Title
- get random item from array javascript
- Category
- JavaScript
- Title
- enter event in jquery
- Category
- JavaScript
- Title
- hello
- Category
- JavaScript
- Title
- Encoding and Decoding Base64 Strings in Node.js
- Category
- JavaScript
- Title
- add set time out in jquery
- Category
- JavaScript
- Title
- fetch json post
- Category
- JavaScript
- Title
- FUNCION EN OBJETO JAVASCRIPT
- Category
- JavaScript
- Title
- angular subscribe
- Category
- JavaScript
- Title
- angularjs filter array of objects based on name prop
- Category
- JavaScript
- Title
- get current time epoch javascript
- Category
- JavaScript
- Title
- create child element in javascript
- Category
- JavaScript
- Title
- erela client userID
- Category
- JavaScript
- Title
- bootstrap modal remove gray background
- Category
- JavaScript
- Title
- javacript getHTTPURL
- Category
- JavaScript
- Title
- fetch api javascript
- Category
- JavaScript
- Title
- error duplicate resources react native
- Category
- JavaScript
- Title
- geolocation speed
- Category
- JavaScript
- Title
- express server replit
- Category
- JavaScript
- Title
- choose random from array javascript
- Category
- JavaScript
- Title
- how accurate is pi javascript
- Category
- JavaScript
- Title
- angular add debounce time before putting valu in subject next
- Category
- JavaScript
- Title
- getelementbyid
- Category
- JavaScript
- Title
- how to sepaarte text in object javascript
- Category
- JavaScript
- Title
- how to add class to element on mouseclick with js
- Category
- JavaScript
- Title
- javascript array push method
- Category
- JavaScript
- Title
- deny ready jquery
- Category
- JavaScript
- Title
- window location in react
- Category
- JavaScript
- Title
- chart.js reduce doughnut tickness
- Category
- JavaScript
- Title
- javascript check if dom element exists
- Category
- JavaScript
- Title
- device height react native
- Category
- JavaScript
- Title
- console log larger
- Category
- JavaScript
- Title
- callback in response node.js
- Category
- JavaScript
- Title
- enable disable click on div jquery
- Category
- JavaScript
- Title
- angular bootstrap not working
- Category
- JavaScript
- Title
- bookshelf insert multiple rows
- Category
- JavaScript
- Title
- dataset js
- Category
- JavaScript
- Title
- how to return an object in javascript
- Category
- JavaScript
- Title
- how to craete a shopping cart in node js
- Category
- JavaScript
- Title
- html table to excel javascript
- Category
- JavaScript
- Title
- firestore set a document
- Category
- JavaScript
- Title
- javascript check for null variables
- Category
- JavaScript
- Title
- how to remove an object from array in react native
- Category
- JavaScript
- Title
- javascript base64 encode
- Category
- JavaScript
- Title
- javascript bigint
- Category
- JavaScript
- Title
- javascript check if a value is an int
- Category
- JavaScript
- Title
- CSRF token in js
- Category
- JavaScript
- Title
- how to create a popup in javascript
- Category
- JavaScript
- Title
- if statemnt shorthand js without else
- Category
- JavaScript
- Title
- check if class is active jquery
- Category
- JavaScript
- Title
- check row empty array javascript
- Category
- JavaScript
- Title
- javascript array split chunk
- Category
- JavaScript