Developing SPI
Applications using
Grails and Angular JS
Álvaro Sánchez-Mariscal
Web Architect – odobo
!

@alvaro_sanchez
About me
• Passionate software developer.
• Founded Salenda in 2005.
• Co-founded Escuela de Groovy in 2009.
• Groovy/Grai...
• HTML5 games platform for:
• Game developers.
• Casinos.
• We are hiring!

• http://bit.ly/odobo-grails-job
Typical Grails
Architecture
Monolithic!
Slow GSP rendering!
!

Slow startup time!
!

Memory consumption,
reloading issues...
From official Grails
documentation…
It’s like….
Other problems
• It’s tricky to decouple the view layer to
render views for different devices.

• It’s difficult to do fre...
Ok... WTF is a Single
Page Application?
• A webapp where you can navigate
without any page refresh.

• Ajax/REST is used to communicate with
the server.

• The MV...
Seriously??

WTF!?!?
Did you say
Javascript??
Oh yeah me
too!
I like
Javascript!
I’m fine with Grails,
thanks. Why should I
care about SPI?
The front end revolution
Grails 3.0 will have
application profiles
Grails is evolving
• It already happened with Hibernate.
• GORM is now decoupled from relational
DB’s.

• It will happen w...
• Faster.
• Better user
experience.

Graceful
•degradation?
Communication
•failures?

• Ops-friendly. •Offline usage?
• Ea...
Other benefits
• You get ready to expose a public API.
• Each layer can be sized, scaled and
redeployed independently.

• ...
I’m sold!! How can I do
that with Grails??
• Build an API.
• Use Grails 2.3 REST capabilities.
• Define your backend: GORM? Other web
services?

• Make it a robust, ...
•

Focus on:

• Testing.
• Efficient data manipulation / caching.
• Security.
• Scalability.
T is much
RES
than just
more

ing JSON.
return
RESTful is about*
Client / server.
Stateless.
Cacheable.
Layered.
* Source: Wikipedia.
What are the
alternatives for the
client side?
Tools a fronted
developer will love
todomvc.com
• Todo app implemented in lot of
frameworks
Similar features
Grails

AngularJS

Domain class

Model

GSP’s and templates

Views and templates

${}

{{ }}

Controllers...
Grails & Angular
• Angular will issue an OPTIONS request
as per CORS:

• Use cors plugin.
• Manually configure URL mapping...
Also bear in mind
• Think about deployment.
• Do you really need a full servlet
container?

• Document your API.
• Swagger...
Create a Swagger
plugin for Grails 2.3+
Demo
http://bit.ly/grails-angular
Thanks!
Álvaro Sánchez-Mariscal
Web Architect – odobo
!

@alvaro_sanchez
Developing SPI applications using Grails and AngularJS
Developing SPI applications using Grails and AngularJS
Developing SPI applications using Grails and AngularJS
Developing SPI applications using Grails and AngularJS
Upcoming SlideShare
Loading in...5
×

Developing SPI applications using Grails and AngularJS

4,491

Published on

Client-side MVC frameworks like AngularJS are getting more popular over time. They represent a big architectural change to what web developers are used to: moving from server-side MVC to a browser based one.

In this talk I will speak about how Grails can fit with a single-page architecture and discuss the pros and cons of developing that kind of applications.

I will also do a live demo of a sample web application using AngularJS and Grails.

Published in: Technology
3 Comments
8 Likes
Statistics
Notes
  • @efuentesp aparte de tener el plugin CORS instalado, necesitas hacer un mapeo custom en UrlMappings, ya que Grails por defecto no soporta CORS: http://jira.grails.org/browse/GRAILS-10914
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Muy buena presentación Alvaro, intente hacer una prueba con ambas tecnologias, hice una pequeña aplicación del lado del servidor con Grails usando un plugin JAXRS para usar peticiones estilo REST. ademas instale el plugin de CORS como lo indicas. Funciona bien si lo pruebo con Postman (post, gets, put y deletes). Hice el cliente con AngularJS y funciona solo Options, Post y Get; cuando intento eliminar (delete) o actualiza (put) el servidor me envia '405 method not allowed', ¿estare haciendo algo mal o me falta alguna configuración?, no se si el problema este del lado del servidor o del cliente. Gracias de antemano por tu ayuda.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • The video is available at http://skillsmatter.com/podcast/home/developing-spi-applications-using-grails-and-angularjs
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
4,491
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
57
Comments
3
Likes
8
Embeds 0
No embeds

No notes for slide

Developing SPI applications using Grails and AngularJS

  1. 1. Developing SPI Applications using Grails and Angular JS Álvaro Sánchez-Mariscal Web Architect – odobo ! @alvaro_sanchez
  2. 2. About me • Passionate software developer. • Founded Salenda in 2005. • Co-founded Escuela de Groovy in 2009. • Groovy/Grails lover since 2007. • Working now at Odobo as Web Architect.
  3. 3. • HTML5 games platform for: • Game developers. • Casinos. • We are hiring! • http://bit.ly/odobo-grails-job
  4. 4. Typical Grails Architecture
  5. 5. Monolithic!
  6. 6. Slow GSP rendering! ! Slow startup time! ! Memory consumption, reloading issues...
  7. 7. From official Grails documentation…
  8. 8. It’s like….
  9. 9. Other problems • It’s tricky to decouple the view layer to render views for different devices. • It’s difficult to do frequent deployments. • It’s hard to scale development teams.
  10. 10. Ok... WTF is a Single Page Application?
  11. 11. • A webapp where you can navigate without any page refresh. • Ajax/REST is used to communicate with the server. • The MVC is in the browser, written in Javascript.
  12. 12. Seriously?? WTF!?!? Did you say Javascript??
  13. 13. Oh yeah me too! I like Javascript!
  14. 14. I’m fine with Grails, thanks. Why should I care about SPI?
  15. 15. The front end revolution
  16. 16. Grails 3.0 will have application profiles
  17. 17. Grails is evolving • It already happened with Hibernate. • GORM is now decoupled from relational DB’s. • It will happen with Spring MVC as well.
  18. 18. • Faster. • Better user experience. Graceful •degradation? Communication •failures? • Ops-friendly. •Offline usage? • Easier for Effort •duplication? the developer.
  19. 19. Other benefits • You get ready to expose a public API. • Each layer can be sized, scaled and redeployed independently. • It allows frequent UI updates. • It’s easier to create mobile apps. • You can organize/scale your teams better. • Development efforts in parallel.
  20. 20. I’m sold!! How can I do that with Grails??
  21. 21. • Build an API. • Use Grails 2.3 REST capabilities. • Define your backend: GORM? Other web services? • Make it a robust, tested, powerful black box for the front end.
  22. 22. • Focus on: • Testing. • Efficient data manipulation / caching. • Security. • Scalability.
  23. 23. T is much RES than just more ing JSON. return
  24. 24. RESTful is about* Client / server. Stateless. Cacheable. Layered. * Source: Wikipedia.
  25. 25. What are the alternatives for the client side?
  26. 26. Tools a fronted developer will love
  27. 27. todomvc.com • Todo app implemented in lot of frameworks
  28. 28. Similar features Grails AngularJS Domain class Model GSP’s and templates Views and templates ${} {{ }} Controllers Controllers URL Mappings Routing
  29. 29. Grails & Angular • Angular will issue an OPTIONS request as per CORS: • Use cors plugin. • Manually configure URL mappings to avoid 405 responses.
  30. 30. Also bear in mind • Think about deployment. • Do you really need a full servlet container? • Document your API. • Swagger.
  31. 31. Create a Swagger plugin for Grails 2.3+
  32. 32. Demo http://bit.ly/grails-angular
  33. 33. Thanks! Álvaro Sánchez-Mariscal Web Architect – odobo ! @alvaro_sanchez
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×