Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular2 and Spring Boot. How to serve front-end?

Tags:

People also ask

Can spring boot be used for front end?

In that sense Spring also has an impact on frontend. However, it is not a "frontend framework" as such, it is a java framework and can be leveraged wherever java is used.

Is spring boot front end or back end?

There is a high demand for Java developers who use Springboot to develop backends. The second most in-demand backend job is that of a NodeJS developer, as it is easy to learn in comparison with Java, and a ReactJS front end developer can pick up this skill very easily.


I have Spring Boot as back-end and Angular2 as front-end. I want to develop both of them separately and deploy onto Heroku.

They shouldn't have any common dependencies and should be in separate git-repos.

As I understand, there are two main ways to implement:

  1. run npm build and copy dist folder into resource folder of Spring application so last will handle it as a static content

  2. run server for serving exclusively Angular app which will communicate with Spring app (CORS problem appears here?) so there are two servers at sum

I think first way is a bit "dirty" since I do not think that copy folder from one project to another is any good.

And second way is overkill because I have two servers (Tomcat and Node.js, for example). Why should I have server with Angular app if I can simply put Angular inside Spring?

Is there is any more rightful way to make aforementioned?

Thanks.