How to deploy Spring backend environment and Angular 2 applications on any online server?

Please correct if I am doing wrong.

In my web application, I do not use jsp pages for user interface development. Instead, I use html, css, and Angular 2, and the foreground project structure is separate from the inside.

Although I can develop a simple project using the Angular CLI, which is served by the back-end SpringMVC. The front-end uses port 4200, and the backend runs on port 8080. I managed to take and serve a request from Angular 2 to SpringMVC. In local mode, they work fine, now I want them to be hosted on a real server.

How to publish SpringMVC and Angular 2 source code separately, but works in the same domain? I do not use SpringBoot, but front-end and external ones are in separate folders. I do not want to combine both in one project structure and generate a military file and deploy.

What is the best practice for developing SpringMVC back-end and Angular -2 content and deploying it to an online server?

+4
source share
1 answer

What I found works best, works nginx as a static file server and a direct proxy for the spring application.

I usually use angular-cli proxy to create / api / go http: // localhost: 8080

, http://localhost:3000/api/ ** http://localhost:8080/api/ . , /api/

+1

Source: https://habr.com/ru/post/1677269/


All Articles