1

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.

enter image description here

3
  • 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... Commented Apr 11, 2017 at 7:20
  • No it's about configuration, really. Commented Apr 11, 2017 at 7:22
  • 1
    there 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. Commented Apr 11, 2017 at 7:27

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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:

enter image description here

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>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.