Masood Alam
Masood Alam

Reputation: 655

Grails with AngularJS

Need a direction.

Which approach is better when building Grails with AngularJS app.

  1. Use the assests folder for the client code ( ng and JS)
  2. Have a seperate folder for client and server ( but a single war file ), like below

https://github.com/hantsy/angularjs-grails-sample

Basically what are the advantages of one over the other.

Thanks is advance

Upvotes: 3

Views: 1768

Answers (1)

dmahapatro
dmahapatro

Reputation: 50245

It is too broad a question to answer. As a whole, the answer will be: "It depends.."

  • It depends how you want the apps to be?
  • It depends if you want to maintain client and server side implementation in different apps?
  • It depends if you want fine grained access to each sector by different teams, avoiding conflicts while development?

I personally don't believe there is any advantage of one over another approach if all you get is one web application. However, the example you are referring to does not have the client and server implementation in one war.

Client implementation is a Node.js app which hosts the Angular component. Angular makes REST calls to Node web server which in turn makes corresponding REST call to the Grails app.

Alternatively, this can be achieved by hosting the angular component inside assets (according to point 1 in the question) in Grails app itself. Static assets (ng/js/css/html) will be served from here (with the help of asset-pipeline plugin), thus removing the need of the Node.js app as stated earlier.

Once again, which approach supersedes other is a broader discussion and differs from person to person.

However, if you have not kept track of recent developments in latest version of Grails then there is a newly available Grails profile for Angular. On the other hand, Node, Express, Angular (v2 recently) has been a hot cake as well as far as Client side is concerned.

So it would be wise to do more research on this and decide which fits best to the team and ultimately to the organization.

Upvotes: 3

Related Questions