I have been developing an angular2 app with the lite server. Now I would like to deploy this app on a tomcat server to connect with a java backend. I have been using angular
Generate the dist folder using ng build --environment=prod and copy the dist folder contents into tomcat /opt/tomcat/webapps/ROOT/ folder.
When we hit the http://localhost:8080/ in the browser then automatically index.html file will be loaded.
Thanks
I'm running a little script to build the project and then copy it to tomcat. I'm telling angular what the base directory is that it will run under in tomcat.
#!/bin/sh
ng build --base-href /angular/ --prod
mkdir -p /home/xxx/apache-tomcat-8.0.37/webapps/angular
cp -R /home/xxx/angular-clitest/dist/* /home/xxx/apache-tomcat-8.0.37/webapps/angular/
Once thats run, start tomcat and you can access it at: http://localhost:8080/angular