SlideShare a Scribd company logo
1
MEAN Inside
Out
(with AngularX)
Paolo Spadoni, sw engineer - developer @ Lynx
& code enthusiast
2
Do you know this cool
movie? Go and see if
you didn’t!
These guys will
take us to
mean stack!
3
SUMMARY
● MEAN stack technology
architecture
● From MEANtoMEA(X)N (that is.. angularX)
● Use case
● Best practices
● Tips
4
MEAN overview
● MEAN stands for
5
MEAN Mongo
● NOSql
● Schema less MongoDB is a document database in−
which one collection holds different documents.
● Document Oriented Storage Data is stored in the−
form of JSON style documents.
● High performances
6
MEAN Node&Express
● Node.js
– built on V8 chrome engine
– open server framework to build scalable applications
– Non blocking-io for asynchronous call
● Express:
– flexible Node.js middleware;
– Handle postdata, session management, static file serving, routing
rich Api middleware→
7
MEAN Angular
● Advantages of angular
– A complete js framework (vs libraries jquery style)
– Modular: component approach to decompose pages in multiple parts;
– Consistent: services, components, directives.. they have a clean structure
– Possibility to encapsulate and re-use code using components
and directives;
– Using typescript, it has all advantages of typed ad compiled code, so prevent
javascript errors
– Google & wide community supporting the framework, highly maintenable
8
Overall Architecture
9
use them all together!
● Json unique exchange data format–
● Speed of development
● Performances, thanks to node
● Huge community around all this stack technologies
● Javascript only one language–
for front end and backend
10
SUMMARY
● MEAN stack technology overview
● From MEAN to MEA(X)N
(that is..AngularX)
● Use case
● Best practices
● Tips
11
MEAN Angular .. New!!
MEAN was coined by Valeri Karpov, a MongoDB
developer. He introduced the term in a 2013.
In 2014 this cool book I advice, by jeff dickey
Nowadays, it s simple as using a skeleton’
by linnovate to get started (mean.io)
with angularX out of the box
12
SUMMARY
● MEAN stack technology architecture
● From MEANtoMEA(X)N (that is..
angularX!)
● Use case
● Best practices
● Tips
13
USE CASE
Application monitoring remote machines for retail distribution
Cloud message provider
Mean Application
14
SUMMARY
● MEAN stack technology architecture
● From MEANtoMEA(X)N (that is..
angularX!)
● Use case
● Best practices
● Tips & tricks
15
Best practices overview
● Back-end
– Separated layers structure
– Test using mocha
– Use promises es6 instead of callbacks
● Front-end
– Use modularization
– Use routing inside modules
– Have a compact app module
– Use components to Encapsulate code
16
Server side code layers (1)
Structure your backend
with Separated Layers
1) API level (REST)
2) Logic (business)
3) DAO (data access object)
– Model to db;
– Queries;
17
Server side code layers (2)
Suppose in real world you’re monitoring remote machines..
API level (REST) is the interface to client
● Remote gsm messages arrive to messageInterceptor.js
● Front end needs to getTotalMoneyInstantaneous.js
● An operator needs to add a new machine operateOnMachines.js
Hey, Im the client!
18
Server side code layers (3)
● Every hour the customer needs to compute the incomes computation.js
● Every hour the customer needs to check machineStatus.js
● Every hour the customer needs to send mail for alerts mail.js
Logic (Business) is the engine
19
Server side code layers (4)
● Customer needs to retrieve machineDao.js
● Every hour the customer needs to check incomeDao.js
DAO (data access object) is accessing the store
● Sometimes the customer needs to poll messageDao.js
20
Mocha Test (1)
Always use a test framework to validate your backend
poor testing strategy means low
quality software, and customer
21
Mocha Test (2)
as simple as “nmp test”
22
Mocha Test (2)
Steps:
– Describe the test;
– it expects a result
– then write the test recalling
the function to test (parsingMessage)
– remember app.closeServer()
– done()
–
23
Prefer promises againts callbacks (1)
The Callback is an asynchronous equivalent for a function.
it is called at the completion of a given task.
It allows to transform Javascript from single thread to
multi-thread language Non blocking i→ /o NodeJs
24
Prefer promises againts callbacks (2)
The Promise object represents the eventual completion or
failure of an asynchronous operation, and its resulting value.
Promises are the evolution on Es6 of callbacks. Why?
25
Prefer promises againts callbacks (3)
- Callbacks becomes complex when handling nested call,
while promises do it clearly ( Promise.all is the magic)
- Promises handle errors in a more elegant way
- Promises are much more readable
- Less readability means also less capability to scale
26
Best practices overview
● Back-end
– Separated layers structure
– Test using mocha
– Use promises es6 instead of callbacks
● Front-end
– Use modularization
– Use routing inside modules
– Have a compact app module
– Use components to Encapsulate code
27
Frontend use modularization– (1)
Root modules
module & routing definition,
libraries handling
Modules folder contains
1 - SHARED MODULES
‘Core , Shared , Common’ ’ ’ ’ ’
2 - feature modules
(dedicated modules for specific features)
28
Frontend - use modularization (2)
root.component.ts contains only navigator and router
29
Frontend use modularization– (3)
App.module.ts so
clean !
30
Frontend Routing at module level–
App.routing.module.ts - use loadChildren
AppRoutingModule
redirects to routes
on each module
31
Frontend Routing at module level–
Don t perform routing inside app.routing.ts’ →
no modularity, less scalability
const routes: Routes = [
path: '', pathMatch: 'full', redirectTo: 'first'{ }
path: 'first', component: FirstComponent ,{ }
path: 'second', component: SecondComponent ,{ }
path: 'third', component: ThirdComponent ,{ }
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
)}
export class AppRoutingModule {}
32
Frontend shared module–
Shared module - import external modules once
App.module.ts
Shared.module.ts
33
Frontend core module–
Core module - used only to import services once
App.module.ts
Core.module.ts
34
Encapsulate components - example
1
2
3
4
– Component 1 is updated when component 2 has finished processing;
comp.3 can appear/disappear depending on comp.2;
Comp. 4 needs row info from comp.2
– Every component communicates with others through input and output
35
SUMMARY
● MEAN stack technology architecture
● From MEANtoMEA(X)N (that is..
angularX!)
● Use case
● Best practices
● Tips
36
Use visual studio code
● Robust and extensible architecture
● Strong integration with angularX
● TsLint,JsLint
● Integration with
others (java, c#)
● Free
37
What about cloudifyng your mean
app?!
● You only need a credit card $$$$$$ and some time
● kidding..! Free-tier is a free 1 year plan for new customers
https://scotch.io/tutorials/deploying-a-mean-app-to-amazon-ec2-part-1
MEAN Inside out (with AngularX)

More Related Content

What's hot

Java Threads: Lightweight Processes
Java Threads: Lightweight ProcessesJava Threads: Lightweight Processes
Java Threads: Lightweight Processes
Isuru Perera
 
Java Course 13: JDBC & Logging
Java Course 13: JDBC & LoggingJava Course 13: JDBC & Logging
Java Course 13: JDBC & Logging
Anton Keks
 
As7 jbug j_boss_modules_yang yong
As7 jbug j_boss_modules_yang yongAs7 jbug j_boss_modules_yang yong
As7 jbug j_boss_modules_yang yongjbossug
 
Java Course 12: XML & XSL, Web & Servlets
Java Course 12: XML & XSL, Web & ServletsJava Course 12: XML & XSL, Web & Servlets
Java Course 12: XML & XSL, Web & Servlets
Anton Keks
 
Java programming concept
Java programming conceptJava programming concept
Java programming concept
Sanjay Gunjal
 
Core Java Certification
Core Java CertificationCore Java Certification
Core Java Certification
Vskills
 
Java SE 9 modules (JPMS) - an introduction
Java SE 9 modules (JPMS) - an introductionJava SE 9 modules (JPMS) - an introduction
Java SE 9 modules (JPMS) - an introduction
Stephen Colebourne
 

What's hot (8)

Java Threads: Lightweight Processes
Java Threads: Lightweight ProcessesJava Threads: Lightweight Processes
Java Threads: Lightweight Processes
 
Java Course 13: JDBC & Logging
Java Course 13: JDBC & LoggingJava Course 13: JDBC & Logging
Java Course 13: JDBC & Logging
 
As7 jbug j_boss_modules_yang yong
As7 jbug j_boss_modules_yang yongAs7 jbug j_boss_modules_yang yong
As7 jbug j_boss_modules_yang yong
 
Java Course 12: XML & XSL, Web & Servlets
Java Course 12: XML & XSL, Web & ServletsJava Course 12: XML & XSL, Web & Servlets
Java Course 12: XML & XSL, Web & Servlets
 
Java programming concept
Java programming conceptJava programming concept
Java programming concept
 
camel-scala.pdf
camel-scala.pdfcamel-scala.pdf
camel-scala.pdf
 
Core Java Certification
Core Java CertificationCore Java Certification
Core Java Certification
 
Java SE 9 modules (JPMS) - an introduction
Java SE 9 modules (JPMS) - an introductionJava SE 9 modules (JPMS) - an introduction
Java SE 9 modules (JPMS) - an introduction
 

Similar to MEAN Inside out (with AngularX)

Real World AngularJS recipes: beyond TodoMVC
Real World AngularJS recipes: beyond TodoMVCReal World AngularJS recipes: beyond TodoMVC
Real World AngularJS recipes: beyond TodoMVC
Carlo Bonamico
 
Real World AngularJS recipes: beyond TodoMVC - Carlo Bonamico, Sonia Pini - C...
Real World AngularJS recipes: beyond TodoMVC - Carlo Bonamico, Sonia Pini - C...Real World AngularJS recipes: beyond TodoMVC - Carlo Bonamico, Sonia Pini - C...
Real World AngularJS recipes: beyond TodoMVC - Carlo Bonamico, Sonia Pini - C...
Codemotion
 
Microservice pitfalls
Microservice pitfalls Microservice pitfalls
Microservice pitfalls
Mite Mitreski
 
MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...
MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...
MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...
Jitendra Bafna
 
Industrial Training.pptx
Industrial Training.pptxIndustrial Training.pptx
Industrial Training.pptx
SamraatBansal1
 
Presentation on angular 5
Presentation on angular 5Presentation on angular 5
Presentation on angular 5
Ramesh Adhikari
 
JSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontendJSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontend
Vlad Fedosov
 
FULL stack -> MEAN stack
FULL stack -> MEAN stackFULL stack -> MEAN stack
FULL stack -> MEAN stack
Ashok Raj
 
26 top angular 8 interview questions to know in 2020 [www.full stack.cafe]
26 top angular 8 interview questions to know in 2020   [www.full stack.cafe]26 top angular 8 interview questions to know in 2020   [www.full stack.cafe]
26 top angular 8 interview questions to know in 2020 [www.full stack.cafe]
Alex Ershov
 
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JSFestUA
 
Foster - Getting started with Angular
Foster - Getting started with AngularFoster - Getting started with Angular
Foster - Getting started with Angular
MukundSonaiya1
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN StackRob Davarnia
 
JavaFX in Action Part I
JavaFX in Action Part IJavaFX in Action Part I
JavaFX in Action Part I
Mohammad Hossein Rimaz
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
SaleemMalik52
 
Workshop 2: JavaScript Design Patterns
Workshop 2: JavaScript Design PatternsWorkshop 2: JavaScript Design Patterns
Workshop 2: JavaScript Design Patterns
Visual Engineering
 
Angular meetup 2 2019-08-29
Angular meetup 2   2019-08-29Angular meetup 2   2019-08-29
Angular meetup 2 2019-08-29
Nitin Bhojwani
 
Advanced Node.JS Meetup
Advanced Node.JS MeetupAdvanced Node.JS Meetup
Advanced Node.JS Meetup
LINAGORA
 
Jab12 - Joomla! architecture revealed
Jab12 - Joomla! architecture revealedJab12 - Joomla! architecture revealed
Jab12 - Joomla! architecture revealed
Ofer Cohen
 
Angular.ppt
Angular.pptAngular.ppt
Angular.ppt
Mytrux1
 
Top 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular AppTop 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular App
Katy Slemon
 

Similar to MEAN Inside out (with AngularX) (20)

Real World AngularJS recipes: beyond TodoMVC
Real World AngularJS recipes: beyond TodoMVCReal World AngularJS recipes: beyond TodoMVC
Real World AngularJS recipes: beyond TodoMVC
 
Real World AngularJS recipes: beyond TodoMVC - Carlo Bonamico, Sonia Pini - C...
Real World AngularJS recipes: beyond TodoMVC - Carlo Bonamico, Sonia Pini - C...Real World AngularJS recipes: beyond TodoMVC - Carlo Bonamico, Sonia Pini - C...
Real World AngularJS recipes: beyond TodoMVC - Carlo Bonamico, Sonia Pini - C...
 
Microservice pitfalls
Microservice pitfalls Microservice pitfalls
Microservice pitfalls
 
MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...
MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...
MuleSoft Surat Virtual Meetup#6 - MuleSoft Project Template Using Maven Arche...
 
Industrial Training.pptx
Industrial Training.pptxIndustrial Training.pptx
Industrial Training.pptx
 
Presentation on angular 5
Presentation on angular 5Presentation on angular 5
Presentation on angular 5
 
JSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontendJSFest 2019: Technology agnostic microservices at SPA frontend
JSFest 2019: Technology agnostic microservices at SPA frontend
 
FULL stack -> MEAN stack
FULL stack -> MEAN stackFULL stack -> MEAN stack
FULL stack -> MEAN stack
 
26 top angular 8 interview questions to know in 2020 [www.full stack.cafe]
26 top angular 8 interview questions to know in 2020   [www.full stack.cafe]26 top angular 8 interview questions to know in 2020   [www.full stack.cafe]
26 top angular 8 interview questions to know in 2020 [www.full stack.cafe]
 
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
JS Fest 2019/Autumn. Влад Федосов. Technology agnostic microservices at SPA f...
 
Foster - Getting started with Angular
Foster - Getting started with AngularFoster - Getting started with Angular
Foster - Getting started with Angular
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN Stack
 
JavaFX in Action Part I
JavaFX in Action Part IJavaFX in Action Part I
JavaFX in Action Part I
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshare
 
Workshop 2: JavaScript Design Patterns
Workshop 2: JavaScript Design PatternsWorkshop 2: JavaScript Design Patterns
Workshop 2: JavaScript Design Patterns
 
Angular meetup 2 2019-08-29
Angular meetup 2   2019-08-29Angular meetup 2   2019-08-29
Angular meetup 2 2019-08-29
 
Advanced Node.JS Meetup
Advanced Node.JS MeetupAdvanced Node.JS Meetup
Advanced Node.JS Meetup
 
Jab12 - Joomla! architecture revealed
Jab12 - Joomla! architecture revealedJab12 - Joomla! architecture revealed
Jab12 - Joomla! architecture revealed
 
Angular.ppt
Angular.pptAngular.ppt
Angular.ppt
 
Top 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular AppTop 7 Angular Best Practices to Organize Your Angular App
Top 7 Angular Best Practices to Organize Your Angular App
 

Recently uploaded

Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 

Recently uploaded (20)

Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 

MEAN Inside out (with AngularX)

  • 1. 1 MEAN Inside Out (with AngularX) Paolo Spadoni, sw engineer - developer @ Lynx & code enthusiast
  • 2. 2 Do you know this cool movie? Go and see if you didn’t! These guys will take us to mean stack!
  • 3. 3 SUMMARY ● MEAN stack technology architecture ● From MEANtoMEA(X)N (that is.. angularX) ● Use case ● Best practices ● Tips
  • 5. 5 MEAN Mongo ● NOSql ● Schema less MongoDB is a document database in− which one collection holds different documents. ● Document Oriented Storage Data is stored in the− form of JSON style documents. ● High performances
  • 6. 6 MEAN Node&Express ● Node.js – built on V8 chrome engine – open server framework to build scalable applications – Non blocking-io for asynchronous call ● Express: – flexible Node.js middleware; – Handle postdata, session management, static file serving, routing rich Api middleware→
  • 7. 7 MEAN Angular ● Advantages of angular – A complete js framework (vs libraries jquery style) – Modular: component approach to decompose pages in multiple parts; – Consistent: services, components, directives.. they have a clean structure – Possibility to encapsulate and re-use code using components and directives; – Using typescript, it has all advantages of typed ad compiled code, so prevent javascript errors – Google & wide community supporting the framework, highly maintenable
  • 9. 9 use them all together! ● Json unique exchange data format– ● Speed of development ● Performances, thanks to node ● Huge community around all this stack technologies ● Javascript only one language– for front end and backend
  • 10. 10 SUMMARY ● MEAN stack technology overview ● From MEAN to MEA(X)N (that is..AngularX) ● Use case ● Best practices ● Tips
  • 11. 11 MEAN Angular .. New!! MEAN was coined by Valeri Karpov, a MongoDB developer. He introduced the term in a 2013. In 2014 this cool book I advice, by jeff dickey Nowadays, it s simple as using a skeleton’ by linnovate to get started (mean.io) with angularX out of the box
  • 12. 12 SUMMARY ● MEAN stack technology architecture ● From MEANtoMEA(X)N (that is.. angularX!) ● Use case ● Best practices ● Tips
  • 13. 13 USE CASE Application monitoring remote machines for retail distribution Cloud message provider Mean Application
  • 14. 14 SUMMARY ● MEAN stack technology architecture ● From MEANtoMEA(X)N (that is.. angularX!) ● Use case ● Best practices ● Tips & tricks
  • 15. 15 Best practices overview ● Back-end – Separated layers structure – Test using mocha – Use promises es6 instead of callbacks ● Front-end – Use modularization – Use routing inside modules – Have a compact app module – Use components to Encapsulate code
  • 16. 16 Server side code layers (1) Structure your backend with Separated Layers 1) API level (REST) 2) Logic (business) 3) DAO (data access object) – Model to db; – Queries;
  • 17. 17 Server side code layers (2) Suppose in real world you’re monitoring remote machines.. API level (REST) is the interface to client ● Remote gsm messages arrive to messageInterceptor.js ● Front end needs to getTotalMoneyInstantaneous.js ● An operator needs to add a new machine operateOnMachines.js Hey, Im the client!
  • 18. 18 Server side code layers (3) ● Every hour the customer needs to compute the incomes computation.js ● Every hour the customer needs to check machineStatus.js ● Every hour the customer needs to send mail for alerts mail.js Logic (Business) is the engine
  • 19. 19 Server side code layers (4) ● Customer needs to retrieve machineDao.js ● Every hour the customer needs to check incomeDao.js DAO (data access object) is accessing the store ● Sometimes the customer needs to poll messageDao.js
  • 20. 20 Mocha Test (1) Always use a test framework to validate your backend poor testing strategy means low quality software, and customer
  • 21. 21 Mocha Test (2) as simple as “nmp test”
  • 22. 22 Mocha Test (2) Steps: – Describe the test; – it expects a result – then write the test recalling the function to test (parsingMessage) – remember app.closeServer() – done() –
  • 23. 23 Prefer promises againts callbacks (1) The Callback is an asynchronous equivalent for a function. it is called at the completion of a given task. It allows to transform Javascript from single thread to multi-thread language Non blocking i→ /o NodeJs
  • 24. 24 Prefer promises againts callbacks (2) The Promise object represents the eventual completion or failure of an asynchronous operation, and its resulting value. Promises are the evolution on Es6 of callbacks. Why?
  • 25. 25 Prefer promises againts callbacks (3) - Callbacks becomes complex when handling nested call, while promises do it clearly ( Promise.all is the magic) - Promises handle errors in a more elegant way - Promises are much more readable - Less readability means also less capability to scale
  • 26. 26 Best practices overview ● Back-end – Separated layers structure – Test using mocha – Use promises es6 instead of callbacks ● Front-end – Use modularization – Use routing inside modules – Have a compact app module – Use components to Encapsulate code
  • 27. 27 Frontend use modularization– (1) Root modules module & routing definition, libraries handling Modules folder contains 1 - SHARED MODULES ‘Core , Shared , Common’ ’ ’ ’ ’ 2 - feature modules (dedicated modules for specific features)
  • 28. 28 Frontend - use modularization (2) root.component.ts contains only navigator and router
  • 29. 29 Frontend use modularization– (3) App.module.ts so clean !
  • 30. 30 Frontend Routing at module level– App.routing.module.ts - use loadChildren AppRoutingModule redirects to routes on each module
  • 31. 31 Frontend Routing at module level– Don t perform routing inside app.routing.ts’ → no modularity, less scalability const routes: Routes = [ path: '', pathMatch: 'full', redirectTo: 'first'{ } path: 'first', component: FirstComponent ,{ } path: 'second', component: SecondComponent ,{ } path: 'third', component: ThirdComponent ,{ } ]; @NgModule({ imports: [RouterModule.forRoot(routes)], exports: [RouterModule] )} export class AppRoutingModule {}
  • 32. 32 Frontend shared module– Shared module - import external modules once App.module.ts Shared.module.ts
  • 33. 33 Frontend core module– Core module - used only to import services once App.module.ts Core.module.ts
  • 34. 34 Encapsulate components - example 1 2 3 4 – Component 1 is updated when component 2 has finished processing; comp.3 can appear/disappear depending on comp.2; Comp. 4 needs row info from comp.2 – Every component communicates with others through input and output
  • 35. 35 SUMMARY ● MEAN stack technology architecture ● From MEANtoMEA(X)N (that is.. angularX!) ● Use case ● Best practices ● Tips
  • 36. 36 Use visual studio code ● Robust and extensible architecture ● Strong integration with angularX ● TsLint,JsLint ● Integration with others (java, c#) ● Free
  • 37. 37 What about cloudifyng your mean app?! ● You only need a credit card $$$$$$ and some time ● kidding..! Free-tier is a free 1 year plan for new customers https://scotch.io/tutorials/deploying-a-mean-app-to-amazon-ec2-part-1