SlideShare a Scribd company logo
1 of 38
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 ProcessesIsuru Perera
 
Java Course 13: JDBC & Logging
Java Course 13: JDBC & LoggingJava Course 13: JDBC & Logging
Java Course 13: JDBC & LoggingAnton 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 & ServletsAnton Keks
 
Java programming concept
Java programming conceptJava programming concept
Java programming conceptSanjay Gunjal
 
Core Java Certification
Core Java CertificationCore Java Certification
Core Java CertificationVskills
 
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 introductionStephen 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 - 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
 
Real World AngularJS recipes: beyond TodoMVC
Real World AngularJS recipes: beyond TodoMVCReal World AngularJS recipes: beyond TodoMVC
Real World AngularJS recipes: beyond TodoMVCCarlo Bonamico
 
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.pptxSamraatBansal1
 
Presentation on angular 5
Presentation on angular 5Presentation on angular 5
Presentation on angular 5Ramesh 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 frontendVlad Fedosov
 
FULL stack -> MEAN stack
FULL stack -> MEAN stackFULL stack -> MEAN stack
FULL stack -> MEAN stackAshok 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 AngularMukundSonaiya1
 
Beginning MEAN Stack
Beginning MEAN StackBeginning MEAN Stack
Beginning MEAN StackRob Davarnia
 
Angular kickstart slideshare
Angular kickstart   slideshareAngular kickstart   slideshare
Angular kickstart slideshareSaleemMalik52
 
Workshop 2: JavaScript Design Patterns
Workshop 2: JavaScript Design PatternsWorkshop 2: JavaScript Design Patterns
Workshop 2: JavaScript Design PatternsVisual Engineering
 
Angular meetup 2 2019-08-29
Angular meetup 2   2019-08-29Angular meetup 2   2019-08-29
Angular meetup 2 2019-08-29Nitin Bhojwani
 
Advanced Node.JS Meetup
Advanced Node.JS MeetupAdvanced Node.JS Meetup
Advanced Node.JS MeetupLINAGORA
 
Jab12 - Joomla! architecture revealed
Jab12 - Joomla! architecture revealedJab12 - Joomla! architecture revealed
Jab12 - Joomla! architecture revealedOfer Cohen
 
Angular.ppt
Angular.pptAngular.ppt
Angular.pptMytrux1
 
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 AppKaty Slemon
 

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

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...
 
Real World AngularJS recipes: beyond TodoMVC
Real World AngularJS recipes: beyond TodoMVCReal World AngularJS recipes: beyond TodoMVC
Real World AngularJS recipes: beyond TodoMVC
 
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

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 CCTVshikhaohhpro
 
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 🔝✔️✔️Delhi Call girls
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
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.docxComplianceQuest1
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
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 ...harshavardhanraghave
 
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 WorkerThousandEyes
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
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-...Steffen Staab
 

Recently uploaded (20)

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
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS 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 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
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
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
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 ...
 
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
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
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-...
 

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