Chapter 13. Single-page web applications (and other UI stuff)
This chapter covers
- Why single-page apps are popular
- Advanced Grails layouts and Ajax facilities
- How to manage Grails UI resources
- Modern web app architecture with AngularJS
In chapter 12, we took you through the basics of designing and implementing RESTful API endpoints in your Grails application. And one of the most common consumers of those RESTful endpoint is likely to be a rich web-client application. In this chapter you build exactly that—adding rich desktop-like services to your Grails web tier that leverage today’s hottest JavaScript frameworks and latest web app architecture trends.
But before you leap into the code, let’s consider “What exactly are Single-Page Applications (SPA) and why are they so popular?” Probably the greatest driver that spiked all the interest in SPAs was the release of Gmail. There had been numerous webmail solutions before Gmail, but here was a web-based mail client that had the look and, more importantly, the feel of a desktop application. It dynamically updated your inbox without all that nasty page refresh flickering you were used to, it offered a rich viewing experience for reading and replying to mail items, and it was amazingly fast and responsive. It was like using a desktop mail client. But in a browser!