SlideShare a Scribd company logo
1 of 42
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

What's hot

What's hot (8)

What's new in JBoss BPM Suite 6.1
What's new in JBoss BPM Suite 6.1What's new in JBoss BPM Suite 6.1
What's new in JBoss BPM Suite 6.1
 
Deep dive into jBPM6
Deep dive into jBPM6Deep dive into jBPM6
Deep dive into jBPM6
 
React js Demo Explanation
React js Demo ExplanationReact js Demo Explanation
React js Demo Explanation
 
Jenkins Workflow - An Introduction
Jenkins Workflow - An IntroductionJenkins Workflow - An Introduction
Jenkins Workflow - An Introduction
 
Zend Framework Foundations
Zend Framework FoundationsZend Framework Foundations
Zend Framework Foundations
 
Best Practices in Qt Quick/QML - Part I
Best Practices in Qt Quick/QML - Part IBest Practices in Qt Quick/QML - Part I
Best Practices in Qt Quick/QML - Part I
 
Automated Testing ADF with Selenium
Automated Testing ADF with SeleniumAutomated Testing ADF with Selenium
Automated Testing ADF with Selenium
 
netbeans
netbeansnetbeans
netbeans
 

Similar to Grails & Angular: unleashing the dynamic duo

gDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas EmbletongDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
George Nguyen
 

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

Nicolas Embleton, Advanced Angular JS
Nicolas Embleton, Advanced Angular JSNicolas Embleton, Advanced Angular JS
Nicolas Embleton, Advanced Angular JS
 
AngularJS with TypeScript and Windows Azure Mobile Services
AngularJS with TypeScript and Windows Azure Mobile ServicesAngularJS with TypeScript and Windows Azure Mobile Services
AngularJS with TypeScript and Windows Azure Mobile Services
 
Angular JS deep dive
Angular JS deep diveAngular JS deep dive
Angular JS deep dive
 
GDayX - Advanced Angular.JS
GDayX - Advanced Angular.JSGDayX - Advanced Angular.JS
GDayX - Advanced Angular.JS
 
Angular
AngularAngular
Angular
 
ng-grid and a Simple REST API
ng-grid and a Simple REST APIng-grid and a Simple REST API
ng-grid and a Simple REST API
 
Part 1: ng-grid and a Simple REST API
Part 1: ng-grid and a Simple REST APIPart 1: ng-grid and a Simple REST API
Part 1: ng-grid and a Simple REST API
 
Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas EmbletongDayX 2013 - Advanced AngularJS - Nicolas Embleton
gDayX 2013 - Advanced AngularJS - Nicolas Embleton
 
Introduction to angular js
Introduction to angular jsIntroduction to angular js
Introduction to angular js
 
Dive into AngularJS and directives
Dive into AngularJS and directivesDive into AngularJS and directives
Dive into AngularJS and directives
 
React django
React djangoReact django
React django
 
A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019
A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019
A Gentle Introduction to Angular Schematics - Devoxx Belgium 2019
 
Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017
 
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...
JavaScripters Event Oct 22, 2016 · 2:00 PM: Common Mistakes made by Angular D...
 
Adding User Management to Node.js
Adding User Management to Node.jsAdding User Management to Node.js
Adding User Management to Node.js
 
Introduction to Angular 2
Introduction to Angular 2Introduction to Angular 2
Introduction to Angular 2
 
Introduction to single page application with angular js
Introduction to single page application with angular jsIntroduction to single page application with angular js
Introduction to single page application with angular js
 
Angular Js Basics
Angular Js BasicsAngular Js Basics
Angular Js Basics
 

Recently uploaded

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Recently uploaded (20)

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 

Grails & Angular: unleashing the dynamic duo