Unleashing the Dynamic Duo
Dr. Rubén Mondéjar
Grails & Angular
About Me
twitter : @Ruuben4
homepage :
http://deim.urv.cat/~ruben.mondejar
Working
Groovy & Grails
AngularJS
MicroServices
Teaching / Research
Software Architecture
Web Development
Distributed Systems
Contents
Introduction
Best Solution
Conclusions
Contents
Introduction
Angular2 Profile
Conclusions
Single Page Application
Inception
Architecture
Architecture
Back-End
Back-End
Front-End
Front-End
SPA Frameworks
How it feels to learn JavaScript (2016)
https://hackernoon.com/how-it-feels-to-learn-javascript-in-2016-d3a717dd577f
Angular2 Profile
Grails 3.2.1+
Grails 2 + Angular
●Summary :
○Groovy Calamari Issue 70
http://groovycalamari.com/issues/70
●Example
https://github.com/rmondejar/grails-angular-duo
Grails 3.x
●Gradle powered
sdk use install 3.2.6
sdk use grails 3.2.6
●Gradle powered
●Angular2 profile
Grails 3.2.1+
sdk use grails 3.2.6
grails create-app --inplace -profile angular2
client/
gradle/
gradlew
gradlew.bat
server/
settings.gradle
Grails 3.2.1+
●Gradle powered
●Angular2 profile
○Folder separation
sdk use grails 3.2.6
grails create-app --inplace -profile angular2
REST API
/server/grails-app/domain/duo/Example.groovy
import grails.rest.Resource
@Resource(uri='/examples')
class Example {
String title
int num
}
/server/grails-app/init/duo/Bootstrap.groovy
class BootStrap {
def init = { servletContext ->
10.times {
new Example(title: "Example #${it+1}", num: it+1).save()
}
}
(...)
server/grails create-domain-class duo.Example
http://localhost:8080/examples
[{"id":1,"num":1,"title":"Example #1"},
{"id":2,"num":2,"title":"Example #2"},
{"id":3,"num":3,"title":"Example #3"},
{"id":4,"num":4,"title":"Example #4"},
{"id":5,"num":5,"title":"Example #5"},
{"id":6,"num":6,"title":"Example #6"},
{"id":7,"num":7,"title":"Example #7"},
{"id":8,"num":8,"title":"Example #8"},
{"id":9,"num":9,"title":"Example #9"},
{"id":10,"num":10,"title":"Example #10"}]
Local Execution
./gradlew server:bootRun
http://localhost:8080/
Starting a Gradle Daemon (subsequent builds will be faster)
:server:compileJava UP-TO-DATE
:server:compileGroovy UP-TO-DATE
:server:buildProperties UP-TO-DATE
:server:processResources UP-TO-DATE
:server:classes UP-TO-DATE
:server:findMainClass
:server:bootRun
Grails application running at http://localhost:8080 in environment: development
Client side
●Minimal NPM ecosystem
1. NVM tool (optional)
2. Node (NPM)
3. Angular CLI
Client side
●Minimal NPM ecosystem
●First time (using nvm tool)
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash
nvm install --lts
nvm use node
npm install -g angular-cli
Requirements
● NVM tool
● Node (NPM)
● Angular CLI
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && .
"$NVM_DIR/nvm.sh" # This loads nvm
Client side
● Minimal NPM ecosystem
● First time (using nvm tool)
●Typically (fresh terminal)
nvm use node
Now using node v6.9.5 (npm v3.10.10)
Angular2
● TypeScript
● Modules
● Components
● Services
● Classes
Angular 2 for Java Developers
https://www.slideshare.net/slideshow/embed_code/key/BefUJQP36rJ3PM
Angular CLI
Angular2 template app
Angular CLI
Angular2 template app
Scaffolding
ng generate class Example -> /client/app/example.ts
export class Example {
num: number;
title: string = '';
constructor(values: Object = {}) {
Object.assign(this, values);
}
}
Angular CLI
Scaffold Usage
Component ng g component my-new-component
Directive ng g directive my-new-directive
Service ng g service my-new-service
Class ng g class my-new-class
Interface ng g interface my-new-interface
Module ng g module my-module
REST Client
ng generate service Example -> /client/app/example.service.ts
get(id: number): Promise<Example> {
return this.http.get('http://localhost:8080/examples/${id}')
.toPromise().then( (response) => {
let example: Example = new Example(response.json());
return template;
})
.catch( (error) => {
this.handleResponseError(error)
});
}
Local Execution
./gradlew server:bootRun ./gradlew client:bootRun
http://localhost:8080/ http://localhost:4200
Starting a Gradle Daemon (subsequent builds will be faster)
:server:compileJava UP-TO-DATE
:server:compileGroovy UP-TO-DATE
:server:buildProperties UP-TO-DATE
:server:processResources UP-TO-DATE
:server:classes UP-TO-DATE
:server:findMainClass
:server:bootRun
Grails application running at http://localhost:8080 in environment: development
Starting a Gradle Daemon, 1 busy Daemon could not be reused, use --status for
details
:client:nodeSetup SKIPPED
:client:npmSetup SKIPPED
:client:npmInstall UP-TO-DATE
:client:bootRun
** NG Live Development Server is running on http://localhost:4200. **
webpack: Compiled successfully.
[default] Checking started in a separate process...
[default] Ok, 2.106 sec.
Local Execution
./gradlew server:bootRun
./gradlew bootRun --parallel
./gradlew client:bootRun
http://localhost:8080/
http://localhost:4200
http://localhost:4200/
Testing
Client application comes with some executable tests
./gradlew test
Executes unit tests with Karma and Jasmine
Integration tests will execute e2e tests with Protractor
./gradlew integrationTest
Build
●Back-End
./gradlew war
/server/build/libs/duo.war
●Front-End
ng build
/client/src/dist
Deployment
Cross-Origin
CORS
By default is enabled
server/grails-app/conf/application.yml
grails:
cors:
enabled: true
REST service can be accessed from different domains
API Securitization
Spring Security REST
http://alvarosanchez.github.io/grails-angularjs-springsecurity-workshop/
Repository
●Example
https://github.com/rmondejar/grails3-angular2-duo
Conclusions
In March 2017
Benefits
Reduced Toolkit
Integrated Tasks
Separated Folders
Benefits
Extended Profiles
Boilerplate code
Scaffolding
Improvements
Client Scaffolding
TypeScript code
Unique build
Gradle Task (Back-End)
More SPA Frameworks
Ex. Angular 4
Unleashing the Dynamic Duo
Dr. Rubén Mondéjar
Grails & Angular

More Related Content

PDF
Introducing Workflow Architectures Using Grails - Greach 2015
PDF
My "Perfect" Toolchain Setup for Grails Projects
PDF
AngularJS Workshop
ODP
What's new in jBPM6
DOCX
Creating Repository & Project area and exploring the project area in Rational...
ODP
jBPM6 Updates
PPTX
Go Fullstack: JSF for Public Sites (CONFESS 2012)
PDF
Front end microservices - October 2019
Introducing Workflow Architectures Using Grails - Greach 2015
My "Perfect" Toolchain Setup for Grails Projects
AngularJS Workshop
What's new in jBPM6
Creating Repository & Project area and exploring the project area in Rational...
jBPM6 Updates
Go Fullstack: JSF for Public Sites (CONFESS 2012)
Front end microservices - October 2019

What's hot (8)

ODP
What's new in JBoss BPM Suite 6.1
ODP
Deep dive into jBPM6
PPTX
React js Demo Explanation
PPTX
Jenkins Workflow - An Introduction
PDF
Zend Framework Foundations
PPTX
Best Practices in Qt Quick/QML - Part I
 
PDF
Automated Testing ADF with Selenium
PDF
netbeans
What's new in JBoss BPM Suite 6.1
Deep dive into jBPM6
React js Demo Explanation
Jenkins Workflow - An Introduction
Zend Framework Foundations
Best Practices in Qt Quick/QML - Part I
 
Automated Testing ADF with Selenium
netbeans
Ad

Similar to Grails & Angular: unleashing the dynamic duo (20)

PDF
第1回名古屋Grails/Groogy勉強会「Grailsを始めてみよう!」
PPTX
I am-one-with-angular
PDF
Angular js best practice
KEY
groovy & grails - lecture 9
POT
intoduction to Grails Framework
PDF
Mastering Grails 3 Plugins - GR8Conf US 2016
PDF
Grails 3.0 Preview
PPT
Introduction To Grails
PDF
Mastering Grails 3 Plugins - GR8Conf EU 2016
PDF
Mastering Grails 3 Plugins - Greach 2016
PPTX
Magic with groovy & grails
PPTX
Spring Northwest Usergroup Grails Presentation
PDF
Introduction to AngularJS
PDF
Groovy - Grails as a modern scripting language for Web applications
PDF
Why Grails
PDF
Why Grails?
PPT
Fast web development using groovy on grails
PDF
GDayX - Advanced Angular.JS
PDF
Java Tech & Tools | Grails in the Java Enterprise | Peter Ledbrook
PDF
Grails beginners workshop
第1回名古屋Grails/Groogy勉強会「Grailsを始めてみよう!」
I am-one-with-angular
Angular js best practice
groovy & grails - lecture 9
intoduction to Grails Framework
Mastering Grails 3 Plugins - GR8Conf US 2016
Grails 3.0 Preview
Introduction To Grails
Mastering Grails 3 Plugins - GR8Conf EU 2016
Mastering Grails 3 Plugins - Greach 2016
Magic with groovy & grails
Spring Northwest Usergroup Grails Presentation
Introduction to AngularJS
Groovy - Grails as a modern scripting language for Web applications
Why Grails
Why Grails?
Fast web development using groovy on grails
GDayX - Advanced Angular.JS
Java Tech & Tools | Grails in the Java Enterprise | Peter Ledbrook
Grails beginners workshop
Ad

Recently uploaded (20)

PDF
Canva Desktop App With Crack Free Download 2025?
PDF
4K Video Downloader Crack + License Key 2025
PPTX
SIH2024_IDEA_dy_dx_deepfakedetection.pptx
PDF
Multiverse AI Review 2025_ The Ultimate All-in-One AI Platform.pdf
PDF
OpenTimelineIO Virtual Town Hall - August 2025
PPTX
Phoenix Marketo User Group: Building Nurtures that Work for Your Audience. An...
PDF
Enscape 3D Crack + With 2025 Activation Key free
PDF
Difference Between Website and Web Application.pdf
PPTX
HackYourBrain__UtrechtJUG__11092025.pptx
PPTX
Advanced Heap Dump Analysis Techniques Webinar Deck
PPTX
Hexagone difital twin solution in the desgining
PPTX
Presentation - Summer Internship at Samatrix.io_template_2.pptx
PDF
10 Mistakes Agile Project Managers Still Make
PDF
OpenColorIO Virtual Town Hall - August 2025
PPTX
UNIT II: Software design, software .pptx
PDF
solman-7.0-ehp1-sp21-incident-management
PPT
chapter01_java_programming_object_oriented
PPTX
oracle_ebs_12.2_project_cutoveroutage.pptx
PDF
How to Write Automated Test Scripts Using Selenium.pdf
PDF
DOWNLOAD—IOBit Uninstaller Pro Crack Download Free
Canva Desktop App With Crack Free Download 2025?
4K Video Downloader Crack + License Key 2025
SIH2024_IDEA_dy_dx_deepfakedetection.pptx
Multiverse AI Review 2025_ The Ultimate All-in-One AI Platform.pdf
OpenTimelineIO Virtual Town Hall - August 2025
Phoenix Marketo User Group: Building Nurtures that Work for Your Audience. An...
Enscape 3D Crack + With 2025 Activation Key free
Difference Between Website and Web Application.pdf
HackYourBrain__UtrechtJUG__11092025.pptx
Advanced Heap Dump Analysis Techniques Webinar Deck
Hexagone difital twin solution in the desgining
Presentation - Summer Internship at Samatrix.io_template_2.pptx
10 Mistakes Agile Project Managers Still Make
OpenColorIO Virtual Town Hall - August 2025
UNIT II: Software design, software .pptx
solman-7.0-ehp1-sp21-incident-management
chapter01_java_programming_object_oriented
oracle_ebs_12.2_project_cutoveroutage.pptx
How to Write Automated Test Scripts Using Selenium.pdf
DOWNLOAD—IOBit Uninstaller Pro Crack Download Free

Grails & Angular: unleashing the dynamic duo