SlideShare a Scribd company logo
MEAN to MERN
WeWork 7 Feb 2017
Troy Miles
• Troy Miles aka the RocknCoder
• Over 37 years of programming
experience
• Speaker and author
• bit.ly/rc-jquerybook
• rockncoder@gmail.com
• @therockncoder
• Now a lynda.com Author!

Build Mobile Apps!
• Develop mobile apps with
Ionic and AngularJS
• Learn the Ionic CLI
• Fetch data via ajax
• Deploy your app to Android &
iOS
• bit.ly/ionicvideo
From MEAN to the MERN Stack
From MEAN to the MERN Stack
From MEAN to the MERN Stack
From MEAN to the MERN Stack
Tonight’s Agenda
• The MEAN Stack
• Heroku
• MongoDB
• NodeJS + Express
• Angular 2
• The MERN Stack
• MERN.io
• MERN CLI
• Redux + React Router
• Electrode
• Summary
Get Git
• Get is a mandatory tool for using all open source
tools
• lots of free tutorials on how to use it
• https://www.codeschool.com/learn/git
• https://git-scm.com/
The MEAN Stack
• MEAN is a free and open-source JavaScript
software stack for building dynamic web sites and
web applications.
• Term coined by Valeri Karpov
MongoDB
• MongoDB is an open-source, document database
designed for ease of development and scaling.
• v3.2
• Initial release - 2009
• https://www.mongodb.org/
Express
• Fast, unopinionated, minimalist web framework for
Node.js
• v4.14
• http://expressjs.com/
Angular
• HTML enhanced for web apps!
• v2.2.3
• https://angular.io/
NodeJS
• Node.js® is a platform built on Chrome's V8
JavaScript runtime for easily building fast, scalable
network applications.
• v7.2.0
• https://nodejs.org/
Benefits of the MEAN Stack
• Isomorphic JavaScript
• Open Source / Community Driven
• Performance
• Low Cost
Isomorphic JavaScript
• One language all the way thru
• Client/Server JavaScript
• JSON as the data transport format
• BSON as the data storage format
• JavaScript to control Mongo DB
Why is JavaScript Beautiful?
• It is a Functional Language - Closer to Lisp and
Scheme than Java or C
• First Class Functions
• Dynamic Objects
• Loose Typing
• and more...
ECMAScript Versions
Version Date
ES1 June 1997
ES2 June 1998
ES3 December 1999
ES4 DOA 2006
ES5 December 2009
ES6/ES2015 June 2015
ES2016 2016
How to use ES6 today?
• Use only the latest browsers
• Use a transpiler: Babel, Traceur, Closure,
TypeScript
• Use Node.js
• https://kangax.github.io/compat-table/es6/
Heroku
Installation
• Create a free heroku account at:
• https://www.heroku.com
• Download + install heroku toolbelt at:
• https://toolbelt.heroku.com/
• (the account is free, no credit card necessary)
Deploy to Heroku
• heroku login
• heroku create <app-name>
• (must be unique)
• git push heroku master
• heroku open
MongoDB
Top DB Engines
1. Oracle
2. MySQL
3. MS SQL Server
4. MongoDB
5. PostgreSQL
6. DB2
7. MS Access
8. Cassandra
9. Redis
10.SQLite
Who Uses It?
• Craigslist
• eBay
• Foursquare
• SourceForge
• Viacom
• Expedia
• LinkedIn
• Medtronic
• eHarmony
• CERN
• and more
When to Use Mongo?
• Document Database
• High Performance
• High Availability
• Easy Scalability
• Geospatial Data
What is a Document?
• An ordered set of keys and values
• Like JavaScript objects
• No duplicate keys allowed
• Type and case sensitive
• Field order is not important nor guaranteed
Node.js
Node v7
• Merged with the io.js project, which was at 3.x
• New version of Chrome V8
• Supports ES6
• Faster
• node -v
Node Package Manager
• Or npm for short
• version: npm -v
• upgrade npm: npm install npm -g
• (officially, npm doesn’t stand for anything, anymore)
package.json
• required properties (error if missing)
• name & version
• optional properties (warning if missing)
• description, repository, & license
• other properties
• scripts, dependencies, config, etc.
Use Environment Vars
• process.env object holds all environment vars
• Reading: var connect = process.env.connect;
• Writing: process.env.mode = ‘test’;
• NEVER PUT SECRET STUFF IN SOURCE CODE!
Express
Installation
• npm install express-generator -g
• npm install express —save
Angular
Angular 2 main concepts
• Component
• Data binding
• Service
• Directive
• Dependency injection
• Module
Metadata
• Metadata is extra information which gives angular
more info
• @Component tells angular the class is a
component
• @Directive tells angular the class is a directive
Component
• A class with component metadata
• Responsible for a piece of the screen referred to as
view.
• Template is a form HTML that tells angular how to
render the component.
• Metadata tells Angular how to process a class
Component
import {Component, OnInit} from 'angular2/core'

import {QuizService} from './quiz-service'



@Component({

selector: 'quiz',

templateUrl: './templates/quiz.html',

providers: [QuizService]

})

export class QuizComponent implements OnInit {

quizList: IQuizList[];



constructor(private _quizService:QuizService) {

}



ngOnInit() {

this.getQuiz();

}



getQuiz() {

this.quizList = this._quizService.getQuizzes();

}

}
Template/View
• Is a way to describe a view using HTML
• Templates can be included with the component
• Or as a URL link to an HTML file
• Best practice is to use an HTML file
Data Binding
C/D Attribute Binding type
—> {{ value }} one-way
—> [property] = “value” property
<— (event) = “handler” event
<—> [(ng-model)] = “property” two-way
Service
• “Substitutable objects that are wired together using
dependency injection (DI)”
• Used to share code across an app
• Lazily instantiated
• Angular has no “Service” defined type
Directive
• A class with directive metadata
• Two kinds: attribute & structural
• Attribute directives alter the look or behavior of an
existing element
• Structural directives alter the layout by adding,
removing, and replacing elements in the DOM
• A component is a directive with a view
Directive
import {Directive, ElementRef, Renderer, Input, OnInit} from 'angular2/core';



@Directive({

selector: '[sizer]'

})

export class Sizer implements OnInit {

@Input() sizer:string;

element:ELementRef;

renderer:Renderer;



constructor(element:ElementRef, renderer:Renderer) {

this.element = element;

this.renderer = renderer;

}



ngOnInit() {

this.renderer.setElementStyle(this.element.nativeElement,

'fontSize', this.sizer + '%');

}

}
Component + Directive
import {Directive, Component, ElementRef, Renderer} from ‘@angular/core';

import {Sizer} from './sizer'



@Component({

selector: 'my-app',

providers: [],

template: `

<div>

<p [sizer]="200">Butter{{name}}</p> 

</div>

`,

directives: [Sizer]

})

export class App {

constructor() {

this.name = 'Monkey'

}

}
Dependency Injection
• A way to supply a new instance of a class with the
fully-formed dependencies it needs
• Most dependencies are services
• Angular know which services a components by
looking at the types of its constructor parameters
• Services are injected by an Injector which uses a
Provider to create the service
Module
• Modules are optional but a best practice
• export tells TypeScript that the resource is a
module available for other modules
• import tells TypeScript the resource in a module
• Angular ships a collection library modules
Webpack
Webpack?
• Module bundler
• Replaces System.JS
• Works with JS, CSS, and HTML
• Minifies, concatenates, and bundles
The MERN Stack
• Keep Mongo, Express, and Node
• Replace Angular with React
• HashNode create mern-cli to scaffold a mern app
• http://mern.io/
MERN CLI
• A scaffolding tool to minimize setup time
• npm install -g mern-cli
• mern init <app_name>
• cd <app_name>
• npm install
• npm start
mern commands
Command Purpose
mern init <name> initialize a MERN app
mern list List MERN variants
mern search <term> Search for a variant
mern info <term> View details of a variant
merng generates a component
npm commands
Command Purpose
npm run start start dev server
npm run bs bundles, starts prod
npm run test starts test runner
npm run watch:test starts test runner in watch
npm run coverage generates coverage report
npm run lint runs linter
generator commands
Command Purpose
dumb-s <name> dumb comp in shared
dumb-m <name> dump comp in module
functional-s <name> functional comp in shared
functional-m <name> functional comp in module
module <name> create a module
React
• A JavaScript library for building UIs
• Created by Facebook & Instagram
• Initial release March 2013
• Highly recommend reading their license
React
• Virtual DOM
• One-way data flow
• JSX - JavaScript eXtension allows in HTML
generation
• Component-based
Flux
• A pattern for managing data flow in your app
• One way data flow
• 4 main parts: Dispatcher, Store, Action, & View
The 4 main parts
• Dispatcher: receives actions & dispatches them to
stores
• Store: holds the data of an app
• Action: define app’s internal API
• View: displays the data from stores
From MEAN to the MERN Stack
Redux
• A predictable state container for JS apps
• Works well with React Native
• An alternative to & inspired by Flux
• Single store for the entire app
• Makes it easier to hot-load your app
React Router
• A complete routing library for React
• Keeps UI in sync with URL
Links
• https://www.mongodb.org/
• http://expressjs.com/
• https://angular.io/
• https://nodejs.org/
• http://mongoosejs.com/
• https://www.heroku.com/
Links
• https://facebook.github.io/react/
• https://facebook.github.io/flux/docs/overview.html
• https://github.com/reactjs/react-redux
• https://github.com/ReactTraining/react-router
• http://mern.io/
• http://www.electrode.io/
Summary
• React is easier to learn than Angular
• When you add in parts like Redux, Flux and React
Router, React is more complex than angular
• In the end choose what is best for you and your
team
• Don’t give in to dogma
Ad

More Related Content

What's hot (20)

MongoDB Days UK: Building Apps with the MEAN Stack
MongoDB Days UK: Building Apps with the MEAN StackMongoDB Days UK: Building Apps with the MEAN Stack
MongoDB Days UK: Building Apps with the MEAN Stack
MongoDB
 
Full stack development tools &amp; technologies
Full stack development tools &amp; technologiesFull stack development tools &amp; technologies
Full stack development tools &amp; technologies
kumar satyam
 
Introduction to mean stack
Introduction to mean stackIntroduction to mean stack
Introduction to mean stack
Praveen Gubbala
 
Get MEAN! Node.js and the MEAN stack
Get MEAN!  Node.js and the MEAN stackGet MEAN!  Node.js and the MEAN stack
Get MEAN! Node.js and the MEAN stack
Nicholas McClay
 
Rapid Application Development with MEAN Stack
Rapid Application Development with MEAN StackRapid Application Development with MEAN Stack
Rapid Application Development with MEAN Stack
Avinash Kaza
 
Mean PPT
Mean PPTMean PPT
Mean PPT
Harendra Singh Bisht
 
Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6
Noam Kfir
 
Mean stack
Mean stackMean stack
Mean stack
Eng Chrispinus Onyancha
 
Introduction to angular js july 6th 2014
Introduction to angular js   july 6th 2014Introduction to angular js   july 6th 2014
Introduction to angular js july 6th 2014
Simona Clapan
 
ASP.NET MVC, AngularJS CRUD for Azerbaijan Technical University
ASP.NET MVC, AngularJS CRUD for Azerbaijan Technical UniversityASP.NET MVC, AngularJS CRUD for Azerbaijan Technical University
ASP.NET MVC, AngularJS CRUD for Azerbaijan Technical University
Syed Shanu
 
Node js projects
Node js projectsNode js projects
Node js projects
💾 Radek Fabisiak
 
MEAN stack
MEAN stackMEAN stack
MEAN stack
Iryney Baran
 
Latest Javascript MVC & Front End Frameworks 2017
Latest Javascript MVC & Front End Frameworks 2017Latest Javascript MVC & Front End Frameworks 2017
Latest Javascript MVC & Front End Frameworks 2017
AmarInfotech
 
After the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEANAfter the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEAN
Jeff Fox
 
Everything you need to know about mern stack programming
Everything you need to know about mern stack programmingEverything you need to know about mern stack programming
Everything you need to know about mern stack programming
JAMESJOHN130
 
Mean full stack development
Mean full stack developmentMean full stack development
Mean full stack development
Scott Lee
 
LAMP is so yesterday, MEAN is so tomorrow! :)
LAMP is so yesterday, MEAN is so tomorrow! :) LAMP is so yesterday, MEAN is so tomorrow! :)
LAMP is so yesterday, MEAN is so tomorrow! :)
Sascha Sambale
 
NodeSummit - MEAN Stack
NodeSummit - MEAN StackNodeSummit - MEAN Stack
NodeSummit - MEAN Stack
Valeri Karpov
 
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sails
Brian Shannon
 
React server side rendering performance
React server side rendering performanceReact server side rendering performance
React server side rendering performance
Nick Dreckshage
 
MongoDB Days UK: Building Apps with the MEAN Stack
MongoDB Days UK: Building Apps with the MEAN StackMongoDB Days UK: Building Apps with the MEAN Stack
MongoDB Days UK: Building Apps with the MEAN Stack
MongoDB
 
Full stack development tools &amp; technologies
Full stack development tools &amp; technologiesFull stack development tools &amp; technologies
Full stack development tools &amp; technologies
kumar satyam
 
Introduction to mean stack
Introduction to mean stackIntroduction to mean stack
Introduction to mean stack
Praveen Gubbala
 
Get MEAN! Node.js and the MEAN stack
Get MEAN!  Node.js and the MEAN stackGet MEAN!  Node.js and the MEAN stack
Get MEAN! Node.js and the MEAN stack
Nicholas McClay
 
Rapid Application Development with MEAN Stack
Rapid Application Development with MEAN StackRapid Application Development with MEAN Stack
Rapid Application Development with MEAN Stack
Avinash Kaza
 
Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6Angular on ASP.NET MVC 6
Angular on ASP.NET MVC 6
Noam Kfir
 
Introduction to angular js july 6th 2014
Introduction to angular js   july 6th 2014Introduction to angular js   july 6th 2014
Introduction to angular js july 6th 2014
Simona Clapan
 
ASP.NET MVC, AngularJS CRUD for Azerbaijan Technical University
ASP.NET MVC, AngularJS CRUD for Azerbaijan Technical UniversityASP.NET MVC, AngularJS CRUD for Azerbaijan Technical University
ASP.NET MVC, AngularJS CRUD for Azerbaijan Technical University
Syed Shanu
 
Latest Javascript MVC & Front End Frameworks 2017
Latest Javascript MVC & Front End Frameworks 2017Latest Javascript MVC & Front End Frameworks 2017
Latest Javascript MVC & Front End Frameworks 2017
AmarInfotech
 
After the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEANAfter the LAMP, it's time to get MEAN
After the LAMP, it's time to get MEAN
Jeff Fox
 
Everything you need to know about mern stack programming
Everything you need to know about mern stack programmingEverything you need to know about mern stack programming
Everything you need to know about mern stack programming
JAMESJOHN130
 
Mean full stack development
Mean full stack developmentMean full stack development
Mean full stack development
Scott Lee
 
LAMP is so yesterday, MEAN is so tomorrow! :)
LAMP is so yesterday, MEAN is so tomorrow! :) LAMP is so yesterday, MEAN is so tomorrow! :)
LAMP is so yesterday, MEAN is so tomorrow! :)
Sascha Sambale
 
NodeSummit - MEAN Stack
NodeSummit - MEAN StackNodeSummit - MEAN Stack
NodeSummit - MEAN Stack
Valeri Karpov
 
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sails
Brian Shannon
 
React server side rendering performance
React server side rendering performanceReact server side rendering performance
React server side rendering performance
Nick Dreckshage
 

Viewers also liked (7)

Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Chun-Kai Wang
 
GraphQL + relay
GraphQL + relayGraphQL + relay
GraphQL + relay
Cédric GILLET
 
MERN Presentation, January 2015
MERN Presentation, January 2015MERN Presentation, January 2015
MERN Presentation, January 2015
Barry Dyck
 
GraphQL Relay Introduction
GraphQL Relay IntroductionGraphQL Relay Introduction
GraphQL Relay Introduction
Chen-Tsu Lin
 
React, GraphQL и Relay - вполне себе нормальный компонентный подход (nodkz)
React, GraphQL и Relay - вполне себе нормальный компонентный подход (nodkz)React, GraphQL и Relay - вполне себе нормальный компонентный подход (nodkz)
React, GraphQL и Relay - вполне себе нормальный компонентный подход (nodkz)
Pavel Chertorogov
 
GraphQL With Relay Part Deux
GraphQL With Relay Part DeuxGraphQL With Relay Part Deux
GraphQL With Relay Part Deux
Brad Pillow
 
GraphQL & Relay
GraphQL & RelayGraphQL & Relay
GraphQL & Relay
Viacheslav Slinko
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Chun-Kai Wang
 
MERN Presentation, January 2015
MERN Presentation, January 2015MERN Presentation, January 2015
MERN Presentation, January 2015
Barry Dyck
 
GraphQL Relay Introduction
GraphQL Relay IntroductionGraphQL Relay Introduction
GraphQL Relay Introduction
Chen-Tsu Lin
 
React, GraphQL и Relay - вполне себе нормальный компонентный подход (nodkz)
React, GraphQL и Relay - вполне себе нормальный компонентный подход (nodkz)React, GraphQL и Relay - вполне себе нормальный компонентный подход (nodkz)
React, GraphQL и Relay - вполне себе нормальный компонентный подход (nodkz)
Pavel Chertorogov
 
GraphQL With Relay Part Deux
GraphQL With Relay Part DeuxGraphQL With Relay Part Deux
GraphQL With Relay Part Deux
Brad Pillow
 
Ad

Similar to From MEAN to the MERN Stack (20)

MEAN Stack Warm-up
MEAN Stack Warm-upMEAN Stack Warm-up
MEAN Stack Warm-up
Troy Miles
 
Angular Application Testing
Angular Application TestingAngular Application Testing
Angular Application Testing
Troy Miles
 
Introduction to React native
Introduction to React nativeIntroduction to React native
Introduction to React native
Dhaval Barot
 
yrs of IT experience in enterprise programming
yrs of IT experience in enterprise programmingyrs of IT experience in enterprise programming
yrs of IT experience in enterprise programming
narasimhulum1623
 
Quick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developersQuick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developers
Paweł Żurowski
 
Micro frontend
Micro frontendMicro frontend
Micro frontend
Amr Abd El Latief
 
better-apps-angular-2-day1.pdf and home
better-apps-angular-2-day1.pdf  and homebetter-apps-angular-2-day1.pdf  and home
better-apps-angular-2-day1.pdf and home
ChethanGowda886434
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and Gaelyk
Guillaume Laforge
 
ASP .Net Core SPA Templates
ASP .Net Core SPA TemplatesASP .Net Core SPA Templates
ASP .Net Core SPA Templates
Eamonn Boyle
 
Angular js 2
Angular js 2Angular js 2
Angular js 2
Ran Wahle
 
Valentine with Angular js - Introduction
Valentine with Angular js - IntroductionValentine with Angular js - Introduction
Valentine with Angular js - Introduction
Senthil Kumar
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5
Ganesh Kondal
 
React state management with Redux and MobX
React state management with Redux and MobXReact state management with Redux and MobX
React state management with Redux and MobX
Darko Kukovec
 
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB Days Silicon Valley: Building Applications with the MEAN StackMongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB
 
Angular IO
Angular IOAngular IO
Angular IO
Jennifer Estrada
 
What is Angular version 4?
What is Angular version 4?What is Angular version 4?
What is Angular version 4?
Troy Miles
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPages
Teamstudio
 
Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...
Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...
Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...
Lucas Jellema
 
Meteor meetup
Meteor meetupMeteor meetup
Meteor meetup
David Brear
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
GDSC UofT Mississauga
 
MEAN Stack Warm-up
MEAN Stack Warm-upMEAN Stack Warm-up
MEAN Stack Warm-up
Troy Miles
 
Angular Application Testing
Angular Application TestingAngular Application Testing
Angular Application Testing
Troy Miles
 
Introduction to React native
Introduction to React nativeIntroduction to React native
Introduction to React native
Dhaval Barot
 
yrs of IT experience in enterprise programming
yrs of IT experience in enterprise programmingyrs of IT experience in enterprise programming
yrs of IT experience in enterprise programming
narasimhulum1623
 
Quick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developersQuick introduction to Angular 4 for AngularJS 1.5 developers
Quick introduction to Angular 4 for AngularJS 1.5 developers
Paweł Żurowski
 
better-apps-angular-2-day1.pdf and home
better-apps-angular-2-day1.pdf  and homebetter-apps-angular-2-day1.pdf  and home
better-apps-angular-2-day1.pdf and home
ChethanGowda886434
 
Google App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and GaelykGoogle App Engine Java, Groovy and Gaelyk
Google App Engine Java, Groovy and Gaelyk
Guillaume Laforge
 
ASP .Net Core SPA Templates
ASP .Net Core SPA TemplatesASP .Net Core SPA Templates
ASP .Net Core SPA Templates
Eamonn Boyle
 
Angular js 2
Angular js 2Angular js 2
Angular js 2
Ran Wahle
 
Valentine with Angular js - Introduction
Valentine with Angular js - IntroductionValentine with Angular js - Introduction
Valentine with Angular js - Introduction
Senthil Kumar
 
Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5Tech io spa_angularjs_20130814_v0.9.5
Tech io spa_angularjs_20130814_v0.9.5
Ganesh Kondal
 
React state management with Redux and MobX
React state management with Redux and MobXReact state management with Redux and MobX
React state management with Redux and MobX
Darko Kukovec
 
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB Days Silicon Valley: Building Applications with the MEAN StackMongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB Days Silicon Valley: Building Applications with the MEAN Stack
MongoDB
 
What is Angular version 4?
What is Angular version 4?What is Angular version 4?
What is Angular version 4?
Troy Miles
 
jQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPagesjQuery: The World's Most Popular JavaScript Library Comes to XPages
jQuery: The World's Most Popular JavaScript Library Comes to XPages
Teamstudio
 
Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...
Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...
Oracle JavaScript Extension Toolkit Web Components Bring Agility to App Devel...
Lucas Jellema
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
GDSC UofT Mississauga
 
Ad

More from Troy Miles (20)

Fast C++ Web Servers
Fast C++ Web ServersFast C++ Web Servers
Fast C++ Web Servers
Troy Miles
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot Camp
Troy Miles
 
AWS Lambda Function with Kotlin
AWS Lambda Function with KotlinAWS Lambda Function with Kotlin
AWS Lambda Function with Kotlin
Troy Miles
 
React Native One Day
React Native One DayReact Native One Day
React Native One Day
Troy Miles
 
React Native Evening
React Native EveningReact Native Evening
React Native Evening
Troy Miles
 
Intro to React
Intro to ReactIntro to React
Intro to React
Troy Miles
 
React Development with the MERN Stack
React Development with the MERN StackReact Development with the MERN Stack
React Development with the MERN Stack
Troy Miles
 
ReactJS.NET
ReactJS.NETReactJS.NET
ReactJS.NET
Troy Miles
 
Angular Weekend
Angular WeekendAngular Weekend
Angular Weekend
Troy Miles
 
Functional Programming in JavaScript
Functional Programming in JavaScriptFunctional Programming in JavaScript
Functional Programming in JavaScript
Troy Miles
 
Functional Programming in Clojure
Functional Programming in ClojureFunctional Programming in Clojure
Functional Programming in Clojure
Troy Miles
 
The JavaScript You Wished You Knew
The JavaScript You Wished You KnewThe JavaScript You Wished You Knew
The JavaScript You Wished You Knew
Troy Miles
 
Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1
Troy Miles
 
Build a Game in 60 minutes
Build a Game in 60 minutesBuild a Game in 60 minutes
Build a Game in 60 minutes
Troy Miles
 
Quick & Dirty & MEAN
Quick & Dirty & MEANQuick & Dirty & MEAN
Quick & Dirty & MEAN
Troy Miles
 
A Quick Intro to ReactiveX
A Quick Intro to ReactiveXA Quick Intro to ReactiveX
A Quick Intro to ReactiveX
Troy Miles
 
JavaScript Foundations Day1
JavaScript Foundations Day1JavaScript Foundations Day1
JavaScript Foundations Day1
Troy Miles
 
AngularJS Beginner Day One
AngularJS Beginner Day OneAngularJS Beginner Day One
AngularJS Beginner Day One
Troy Miles
 
AngularJS on Mobile with the Ionic Framework
AngularJS on Mobile with the Ionic FrameworkAngularJS on Mobile with the Ionic Framework
AngularJS on Mobile with the Ionic Framework
Troy Miles
 
Building Cross-Platform Mobile Apps
Building Cross-Platform Mobile AppsBuilding Cross-Platform Mobile Apps
Building Cross-Platform Mobile Apps
Troy Miles
 
Fast C++ Web Servers
Fast C++ Web ServersFast C++ Web Servers
Fast C++ Web Servers
Troy Miles
 
Node Boot Camp
Node Boot CampNode Boot Camp
Node Boot Camp
Troy Miles
 
AWS Lambda Function with Kotlin
AWS Lambda Function with KotlinAWS Lambda Function with Kotlin
AWS Lambda Function with Kotlin
Troy Miles
 
React Native One Day
React Native One DayReact Native One Day
React Native One Day
Troy Miles
 
React Native Evening
React Native EveningReact Native Evening
React Native Evening
Troy Miles
 
Intro to React
Intro to ReactIntro to React
Intro to React
Troy Miles
 
React Development with the MERN Stack
React Development with the MERN StackReact Development with the MERN Stack
React Development with the MERN Stack
Troy Miles
 
Angular Weekend
Angular WeekendAngular Weekend
Angular Weekend
Troy Miles
 
Functional Programming in JavaScript
Functional Programming in JavaScriptFunctional Programming in JavaScript
Functional Programming in JavaScript
Troy Miles
 
Functional Programming in Clojure
Functional Programming in ClojureFunctional Programming in Clojure
Functional Programming in Clojure
Troy Miles
 
The JavaScript You Wished You Knew
The JavaScript You Wished You KnewThe JavaScript You Wished You Knew
The JavaScript You Wished You Knew
Troy Miles
 
Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1Game Design and Development Workshop Day 1
Game Design and Development Workshop Day 1
Troy Miles
 
Build a Game in 60 minutes
Build a Game in 60 minutesBuild a Game in 60 minutes
Build a Game in 60 minutes
Troy Miles
 
Quick & Dirty & MEAN
Quick & Dirty & MEANQuick & Dirty & MEAN
Quick & Dirty & MEAN
Troy Miles
 
A Quick Intro to ReactiveX
A Quick Intro to ReactiveXA Quick Intro to ReactiveX
A Quick Intro to ReactiveX
Troy Miles
 
JavaScript Foundations Day1
JavaScript Foundations Day1JavaScript Foundations Day1
JavaScript Foundations Day1
Troy Miles
 
AngularJS Beginner Day One
AngularJS Beginner Day OneAngularJS Beginner Day One
AngularJS Beginner Day One
Troy Miles
 
AngularJS on Mobile with the Ionic Framework
AngularJS on Mobile with the Ionic FrameworkAngularJS on Mobile with the Ionic Framework
AngularJS on Mobile with the Ionic Framework
Troy Miles
 
Building Cross-Platform Mobile Apps
Building Cross-Platform Mobile AppsBuilding Cross-Platform Mobile Apps
Building Cross-Platform Mobile Apps
Troy Miles
 

Recently uploaded (20)

Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...Exploring Code Comprehension  in Scientific Programming:  Preliminary Insight...
Exploring Code Comprehension in Scientific Programming: Preliminary Insight...
University of Hawai‘i at Mānoa
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 

From MEAN to the MERN Stack

  • 1. MEAN to MERN WeWork 7 Feb 2017
  • 2. Troy Miles • Troy Miles aka the RocknCoder • Over 37 years of programming experience • Speaker and author • bit.ly/rc-jquerybook • [email protected] • @therockncoder • Now a lynda.com Author!

  • 3. Build Mobile Apps! • Develop mobile apps with Ionic and AngularJS • Learn the Ionic CLI • Fetch data via ajax • Deploy your app to Android & iOS • bit.ly/ionicvideo
  • 8. Tonight’s Agenda • The MEAN Stack • Heroku • MongoDB • NodeJS + Express • Angular 2 • The MERN Stack • MERN.io • MERN CLI • Redux + React Router • Electrode • Summary
  • 9. Get Git • Get is a mandatory tool for using all open source tools • lots of free tutorials on how to use it • https://www.codeschool.com/learn/git • https://git-scm.com/
  • 10. The MEAN Stack • MEAN is a free and open-source JavaScript software stack for building dynamic web sites and web applications. • Term coined by Valeri Karpov
  • 11. MongoDB • MongoDB is an open-source, document database designed for ease of development and scaling. • v3.2 • Initial release - 2009 • https://www.mongodb.org/
  • 12. Express • Fast, unopinionated, minimalist web framework for Node.js • v4.14 • http://expressjs.com/
  • 13. Angular • HTML enhanced for web apps! • v2.2.3 • https://angular.io/
  • 14. NodeJS • Node.js® is a platform built on Chrome's V8 JavaScript runtime for easily building fast, scalable network applications. • v7.2.0 • https://nodejs.org/
  • 15. Benefits of the MEAN Stack • Isomorphic JavaScript • Open Source / Community Driven • Performance • Low Cost
  • 16. Isomorphic JavaScript • One language all the way thru • Client/Server JavaScript • JSON as the data transport format • BSON as the data storage format • JavaScript to control Mongo DB
  • 17. Why is JavaScript Beautiful? • It is a Functional Language - Closer to Lisp and Scheme than Java or C • First Class Functions • Dynamic Objects • Loose Typing • and more...
  • 18. ECMAScript Versions Version Date ES1 June 1997 ES2 June 1998 ES3 December 1999 ES4 DOA 2006 ES5 December 2009 ES6/ES2015 June 2015 ES2016 2016
  • 19. How to use ES6 today? • Use only the latest browsers • Use a transpiler: Babel, Traceur, Closure, TypeScript • Use Node.js • https://kangax.github.io/compat-table/es6/
  • 21. Installation • Create a free heroku account at: • https://www.heroku.com • Download + install heroku toolbelt at: • https://toolbelt.heroku.com/ • (the account is free, no credit card necessary)
  • 22. Deploy to Heroku • heroku login • heroku create <app-name> • (must be unique) • git push heroku master • heroku open
  • 24. Top DB Engines 1. Oracle 2. MySQL 3. MS SQL Server 4. MongoDB 5. PostgreSQL 6. DB2 7. MS Access 8. Cassandra 9. Redis 10.SQLite
  • 25. Who Uses It? • Craigslist • eBay • Foursquare • SourceForge • Viacom • Expedia • LinkedIn • Medtronic • eHarmony • CERN • and more
  • 26. When to Use Mongo? • Document Database • High Performance • High Availability • Easy Scalability • Geospatial Data
  • 27. What is a Document? • An ordered set of keys and values • Like JavaScript objects • No duplicate keys allowed • Type and case sensitive • Field order is not important nor guaranteed
  • 29. Node v7 • Merged with the io.js project, which was at 3.x • New version of Chrome V8 • Supports ES6 • Faster • node -v
  • 30. Node Package Manager • Or npm for short • version: npm -v • upgrade npm: npm install npm -g • (officially, npm doesn’t stand for anything, anymore)
  • 31. package.json • required properties (error if missing) • name & version • optional properties (warning if missing) • description, repository, & license • other properties • scripts, dependencies, config, etc.
  • 32. Use Environment Vars • process.env object holds all environment vars • Reading: var connect = process.env.connect; • Writing: process.env.mode = ‘test’; • NEVER PUT SECRET STUFF IN SOURCE CODE!
  • 34. Installation • npm install express-generator -g • npm install express —save
  • 36. Angular 2 main concepts • Component • Data binding • Service • Directive • Dependency injection • Module
  • 37. Metadata • Metadata is extra information which gives angular more info • @Component tells angular the class is a component • @Directive tells angular the class is a directive
  • 38. Component • A class with component metadata • Responsible for a piece of the screen referred to as view. • Template is a form HTML that tells angular how to render the component. • Metadata tells Angular how to process a class
  • 39. Component import {Component, OnInit} from 'angular2/core'
 import {QuizService} from './quiz-service'
 
 @Component({
 selector: 'quiz',
 templateUrl: './templates/quiz.html',
 providers: [QuizService]
 })
 export class QuizComponent implements OnInit {
 quizList: IQuizList[];
 
 constructor(private _quizService:QuizService) {
 }
 
 ngOnInit() {
 this.getQuiz();
 }
 
 getQuiz() {
 this.quizList = this._quizService.getQuizzes();
 }
 }
  • 40. Template/View • Is a way to describe a view using HTML • Templates can be included with the component • Or as a URL link to an HTML file • Best practice is to use an HTML file
  • 41. Data Binding C/D Attribute Binding type —> {{ value }} one-way —> [property] = “value” property <— (event) = “handler” event <—> [(ng-model)] = “property” two-way
  • 42. Service • “Substitutable objects that are wired together using dependency injection (DI)” • Used to share code across an app • Lazily instantiated • Angular has no “Service” defined type
  • 43. Directive • A class with directive metadata • Two kinds: attribute & structural • Attribute directives alter the look or behavior of an existing element • Structural directives alter the layout by adding, removing, and replacing elements in the DOM • A component is a directive with a view
  • 44. Directive import {Directive, ElementRef, Renderer, Input, OnInit} from 'angular2/core';
 
 @Directive({
 selector: '[sizer]'
 })
 export class Sizer implements OnInit {
 @Input() sizer:string;
 element:ELementRef;
 renderer:Renderer;
 
 constructor(element:ElementRef, renderer:Renderer) {
 this.element = element;
 this.renderer = renderer;
 }
 
 ngOnInit() {
 this.renderer.setElementStyle(this.element.nativeElement,
 'fontSize', this.sizer + '%');
 }
 }
  • 45. Component + Directive import {Directive, Component, ElementRef, Renderer} from ‘@angular/core';
 import {Sizer} from './sizer'
 
 @Component({
 selector: 'my-app',
 providers: [],
 template: `
 <div>
 <p [sizer]="200">Butter{{name}}</p> 
 </div>
 `,
 directives: [Sizer]
 })
 export class App {
 constructor() {
 this.name = 'Monkey'
 }
 }
  • 46. Dependency Injection • A way to supply a new instance of a class with the fully-formed dependencies it needs • Most dependencies are services • Angular know which services a components by looking at the types of its constructor parameters • Services are injected by an Injector which uses a Provider to create the service
  • 47. Module • Modules are optional but a best practice • export tells TypeScript that the resource is a module available for other modules • import tells TypeScript the resource in a module • Angular ships a collection library modules
  • 49. Webpack? • Module bundler • Replaces System.JS • Works with JS, CSS, and HTML • Minifies, concatenates, and bundles
  • 50. The MERN Stack • Keep Mongo, Express, and Node • Replace Angular with React • HashNode create mern-cli to scaffold a mern app • http://mern.io/
  • 51. MERN CLI • A scaffolding tool to minimize setup time • npm install -g mern-cli • mern init <app_name> • cd <app_name> • npm install • npm start
  • 52. mern commands Command Purpose mern init <name> initialize a MERN app mern list List MERN variants mern search <term> Search for a variant mern info <term> View details of a variant merng generates a component
  • 53. npm commands Command Purpose npm run start start dev server npm run bs bundles, starts prod npm run test starts test runner npm run watch:test starts test runner in watch npm run coverage generates coverage report npm run lint runs linter
  • 54. generator commands Command Purpose dumb-s <name> dumb comp in shared dumb-m <name> dump comp in module functional-s <name> functional comp in shared functional-m <name> functional comp in module module <name> create a module
  • 55. React • A JavaScript library for building UIs • Created by Facebook & Instagram • Initial release March 2013 • Highly recommend reading their license
  • 56. React • Virtual DOM • One-way data flow • JSX - JavaScript eXtension allows in HTML generation • Component-based
  • 57. Flux • A pattern for managing data flow in your app • One way data flow • 4 main parts: Dispatcher, Store, Action, & View
  • 58. The 4 main parts • Dispatcher: receives actions & dispatches them to stores • Store: holds the data of an app • Action: define app’s internal API • View: displays the data from stores
  • 60. Redux • A predictable state container for JS apps • Works well with React Native • An alternative to & inspired by Flux • Single store for the entire app • Makes it easier to hot-load your app
  • 61. React Router • A complete routing library for React • Keeps UI in sync with URL
  • 62. Links • https://www.mongodb.org/ • http://expressjs.com/ • https://angular.io/ • https://nodejs.org/ • http://mongoosejs.com/ • https://www.heroku.com/
  • 63. Links • https://facebook.github.io/react/ • https://facebook.github.io/flux/docs/overview.html • https://github.com/reactjs/react-redux • https://github.com/ReactTraining/react-router • http://mern.io/ • http://www.electrode.io/
  • 64. Summary • React is easier to learn than Angular • When you add in parts like Redux, Flux and React Router, React is more complex than angular • In the end choose what is best for you and your team • Don’t give in to dogma