David McLure wrote:Hi Craig! Having read the earlier version(s) of your Spring In Action book and having met you before at a No Fluff / Just Stuff conference, I guess I can say that I am a fan of your work.
For some time now, I have been attempting to blend the deceivingly simple Mongo application tutorial, together with the CORS tutorial on Spring.io to create a REST service which can be accessed by an angular client running on another server and under a different domain name.
Here are links to the two tutorials:
CORS tutorial: http://spring.io/guides/gs/rest-service-cors/
MongoDB with REST http://spring.io/guides/gs/accessing-mongodb-data-rest/
...and here is a link to my [lack of] progress thusfar:
I seem to be stuck on a CORS-related authentication issue, as I can successfully access my service using the following curl command (where user = "myUser" and password= "myPassword" ):
...but I seem to wind up on the login page when I try to use the same URL from my Angular Rest service call:
In my case, I am also attempting to use JHipster (http://jhipster.github.io/) for my Angular based client application.
There appear to be a wide variety of different blogs on the subject of trying to use Angular and Spring in general, and many of the issues seem to revolve around the different CSRF tokens used by Angular (X-XSRF-TOKEN), versus Spring (X-CSRF-TOKEN): https://github.com/jhipster/generator-jhipster/issues/363
I also get the feeling that the CORS issue only scratches the surface, as in my case, I am also running into issues attempting to use Eclipse (STS in my case) for Node-centric projects such as JHipster to begin with - since, for example, Eclipse attempts [unsuccessfully] to validate the entire "node_modules" subdirectory in my Yomen built JHipster Maven project. I suppose I could simplify things a little by creating a simpler Angular client app to use in debugging this problem.
So where am I going with this reply? My goal here is to get your take on the proposed marriage of AngularJs and Spring in general and possibly also on the new Angular & Spring based JHipster initiative. I have read several books on Angular and it seems to be a relatively exciting framework, but frankly I am not having much happiness these days trying to deal with integrating the two technologies - at least not when REST and CORS is involved.
I know that you were also a proponent of Cujojs and so I am wondering whether maybe I am barking up the wrong tree in trying to use AngularJs in the first place? Assuming you are releasing a newer revision of your book, I am wondering whether your latest book revision touches on any of these topics? In either case, please feel free to pontificate on these subjects here as well. More specifically, do you know of any Cujojs client sample applications which do something similar to this? Thanks!