'how to integrate Angular application with Springboot app for the email sending functionality
need some help on how we can get the springboot application integrated into the Angular project. To give a background, i have created a static website using angular, and i have another simpler project springboot email client sending application, which sends email to gmail account. So now, what i would like to do is, get the springboot email client application functionality into the Angular project, wherein i have a form which will send out the user data when the user click on send button. I am quite new to angular and springboot, so for learning purpose i created two different projects and now i would like use the email service in the angular project(in the form send functionality). I am not quite sure if this two projects can be clubbed into one and if yes, can we anyone guide me on how to go about doing it.enter image description hereenter image description here
Solution 1:[1]
You don't integrate you Spring Boot app into Angular, you integrate your builded Angular app into the Spring boot one when you want to deploy your application.
In production :
When you build your Angular app (using ng build --configuration production), you will get some nbasic web ressources like HTML files, CSS files, JS files etc... You need a webserver to serve those files to your clients. Your Spring Boot app can do this, you just need to put those files into your src/main/resources/static file (there are other path that can do the same).
In development :
You want to keep the dev server (ng serve with Angular CLI) and your Spring Boot app at the same time as hot reloading is a must. So, you need to tell Angular CLI to redirect all request to your API (ex: /api) to your Spring Boot app which is listening to another port. To do this, you need ton configure it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Chaniro |
