Grails as a single application or another frontend / frontend application

We are new to grails and are concerned about the following issues:

  • scalability issues

  • Using the same back-end for different applications

So sticking to one grail is a good idea, or we have to share concerns and even use other frameworks like node.js for a rest-based interface.

Secondly, I'm not very clear where we should put the business logic in the grail app.Ideal the place should be services, I suppose

We are looking at Angular.js as it seems to be faster than gsp pages, the current flavor for frontend and grail integration is also easier. You want to check if this is the right option or not.

+3


source to share


2 answers


Grails is very well suited to rapidly evolving needs, and you'll love it when you get a basic understanding of it. You can write a poorly executed application in any framework / language. One thing I would recommend is a good understanding of Hibernate, which is the main persistence library. If you understand how this works, this should help you avoid silly DB-level errors.

In the first part of your question, the scalability of your web application will not depend on which language / framework you prefer to use, but rather how your application is built. You can build a scalable web application in Grails, just like you can create an incredibly slow C ++ application. If Grails is the framework you would like to use, use it; you can always rewrite the slow parts in Java or another fast language if needed. (After all, this is what Twitter did with Scala.)

At our company, we use grails as our client interaction / licensing server and use multiple Node.js servers for analytics. This way, whatever the client gives is stored in the grails server and then the functional data is sent to the Node.js server cluster for further processing. The analytic data from the Node.js server is retrieved by the grails server using the http builder and used to plot charts and data in the dashboard.



// ------------- Update answer for updated question ----------------------

  • Node.js is a server-side technology and it doesn't work on the front-end side, that is, the client-side.
  • In grails, you write all the inbound (to the server) and outbound (from the server) stuff in the controller.
  • Whereas all your business logic / calculations / DB queries go into your service methods. After that, send the received data back to the controller via a return statement and the controller will send / show it to the GSP.
  • Regarding your angular JS question, I would say that you cannot replace GSP with angular JS as GSP is nothing more than server side scripts where you write grails / groovy / java code in script -lets form together with normal HTML and it turns into full HTML and is sent to the client side. So you can only improve your functionality by adding an MVC frontend like angular to it and won't be able to replace it. And wise angular functionality is an excellent framework. Add any JS to your GSP and enjoy them.

PS - You will start loving GSP as soon as you can hang up GSP tags which are so easy to do a lot.

+9


source


To keep things simple, you can build an entire application stack with Grails. You can split / combine your services in any way. You can build an app with any crazy JS-frontend framework or build an app with just REST API. Or mix them together.

Also, you can easily modulate your application using plugins

. The good thing about them is that they can run autonomously, which means you can use the service as part of your application, or run the service outside of the application, this is your decision, not a constraint!



UPDATE:

Grails has a very important point: Groovy is a JVM language. This means that you can use ANY lava library in the world directly in your project. Also, your developers should only learn Groovy as it is used throughout the application, be it domain classes, services, or GSP.

+2


source







All Articles