1

I created Model objects and exposed in REST style using Spring-Data-Rest,is it possible for me to directly use it by respective end-points on client side(Front end)?

Or i need to create Spring MVC Controller which again going to fetch data from DAO Layer and using it on Client side(Front end)?

Asokan
  • 99
  • 1
  • 4

1 Answers1

0

Update:

I'd recommend Traverson, as it's designed to consume Hypermedia APIs. There is a JavaScript version as well as a Java version

You could use the JavaScript version like this:

<script src="traverson.min.js"></script>
<script src="traverson-hal.min.js"></script>
<script>
    traverson.registerMediaType(TraversonJsonHalAdapter.mediaType, TraversonJsonHalAdapter);
    
    traverson.from("http://localhost:8080/")
        .jsonHal()
        .follow("foo")
        .follow("search")
        .withTemplateParameters({name:"Bar"})
        .follow("findByName")
        .follow("some-subresource")
        .getResource((err, doc)=>{
            //do stuff w the resource
        })
</script>

Old answer:

I assume your client is Java. It could be anything that can consume REST though.

You could use RestTemplate in Spring to get the data from the server, and it can convert it into a class on the client for you.

http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/client/RestTemplate.html

Neil McGuigan
  • 46,580
  • 12
  • 123
  • 152