Deploy Angular app in Wildfly together with the REST api it is using?

I made an AngularJs application that just uses my REST api backend (built in Java and deployed on Wildfly).

I made my servers accessible from the Internet using my public IP address (through port-forwarding).

My question is how can I make the Angular application accessible as well from the Internet using my public IP. Can I also deploy it on Wildfly? How do I do that?


You could package your angular application in the same application as your REST backend API.

For example, if you package your REST api within a .war package, you could put your anglar application files (html pages, js scripts, …) in your WAR package root, and your REST resources in WEB-INF/lib directories packaged as JAR files.

See WAR packaging details here.

Then to query your REST api, you just have to provide the resource URI, not the base URL (including webapp context), as angular app belongs to the webapp which also exposes your REST api.

For example, if you want to get one of your resource, you can do like this with angular: (with your REST API using ‘rs’ path in application config and using $http angular service)