I have a Spring Boot back-end and need to implement an AngularJS(2) front-end to consume my REST API (both running on a single server). I'm a beginner but I haven't found a decent tutorial/demo to help me get started, considering that the following image is my project structure.
-
I don't know anyone can really help you.. this question is like "how can i make a spa using angular2 and spring" and it does not have a single answer...Imal Hasaranga Perera– Imal Hasaranga Perera2017-04-11 07:20:46 +00:00Commented Apr 11, 2017 at 7:20
-
No it's about configuration, really.Helenesh– Helenesh2017-04-11 07:22:36 +00:00Commented Apr 11, 2017 at 7:22
-
1there is no specific configuration required to get angular 2 with spring. all you need to do is make sure that your spring server deals with rest, and I suggest keeping both spring and angular2 as two separate projects hosted in same machine.Imal Hasaranga Perera– Imal Hasaranga Perera2017-04-11 07:27:46 +00:00Commented Apr 11, 2017 at 7:27
Add a comment
|
2 Answers
I'd recommend to have a look at jhipster (https://jhipster.github.io/), it's a yeoman generator that gives you a very nice, clean and tested codebase mixing a spring api and an angular front end. You can set up a project pretty fast and learn a lot from it's structure.
Comments
You should place the front-end in resources/public or resources/static or the third one which I don't remember.
Possible directory structure can be:
in resources/public.
You also should point to that folder in your pom.xml.
<build>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
</resource>
<resource>
<directory>${project.build.directory}/generated-resources</directory>
</resource>
</resources>
</build>

