● Madhukara Phatak
● Big data and FP
consultant
● Spark,Hadoop and
ecosystem
● @madhukaraphatak
● www.
madhukaraphatak.com
Agenda
● What is a stack?
● LAMP stack
● MEAN stack
● LAMP vs MEAN
● Why MEAN?
● MEAN technologies
● Hands on
Stack
● Set of independent tools working together to
solve a specific problem
● These tools can be used in other settings
● But when they are used together, they result
in something elegant and useful
● Ex : LAMP, MEAN etc
LAMP stack
● Linux operating system
● Apache web server
● MySQL database
● php for web programming
A stack for building powerful websites.
Variation in LAMP
● Tomcat, Glassfish in place of Apache
● Oracle, Postgresql in place of Mysql
● Servlets, ASP.net in place of Php
All of these share common idea of web
development.
MEAN stack
● V8 is the operating system
● MongoDB is for the storage
● Express for the web programming
● Angular is for the frontend development
● Node for the web server
Powerful stack to build RESTful CRUD
applications.
LAMP MEAN
Linux V8 engine
Apache web server Node
Mysql Mongodb
Php Express
Why MEAN?
● Building RESTful APIs in a typical LAMP
stack is too much of work...
● Single language rules entire stack
● LAMP is build for websites, not for web
applications
● Lot’s of fun...
REST
● REpresentational State Transfer
● Architectural way of creating API on web
● Used in web services
● Component
○ URI
○ medium primarily json but formats like xml also can
be used
○ HTTP methods for operation
Meaning of REST
URI - http://www.example.com/resource
● Get - get collection
● Put - replace collection
● Post - add a new entry to collection
● Delete - delete the collection
http://www.example.com/resource/1234 is a way
to deal with specific element in the collection
REST in LAMP
Client (Browser) Server ( GSON to
JSON
Java Objects)
ORM
(Hibernate)
Mysql
(Tables)
Challenges
1. Adding a new field
2. Mapping nested json to RDBMS schema
3. Lost in translation
REST in MEAN
Client (Browser) JSON Server JSON
Mongodb
(JSON)
Advantages
1. Adding a new field
2. Mapping nested JSON to Mongodb
schema
3. No translation need
JSON is the secret sauce of MEAN
● Every component in MEAN stack talks in
JSON
● Having JSON as the standard makes life
very easy for a developer
● Javascript is the language where json is
default
● With mongodb, even databases going in
JSON direction.
What MEAN is good for
● CRUD web applications
● REST API servers
● Single page apps
● Static content servers
Actually anything I/O Bound.
What MEAN is not good for?
● Computation intensive applications
● Number crunching machines
● Transactional systems etc
Read it later service
● Allow you to save links to read it later
● You can add links from browser, phone etc
● Uses REST API to communicate
● Ex : Instapaper, pocket ( read it later)
Node.js
● Javascript Runtime
● Written in C/C++
● Runs on V8, Javascript VM for Chrome
● Follows module structure
● Modules can be written both in JS/C
● npm is module manager
Async programming
● Every node.js program is a series of events
● Each event completes asynchronously
● Each event will have callback associated
● Two possibilities
○ Error
○ Result of the events
Express
● Fast, minimal un opinionated web framework
for node.js
● Important concepts
○ Application
○ Middleware
○ Router ( Type of middleware )
AngularJs
● Javascript framework for rich client
development aka single page apps
● Follows MVC paradigm, where
○ Model - javascript object
○ View - html and css
○ Controller - Angular code to bind view and model
● Powerful two way data binding.