SlideShare a Scribd company logo
HOW TO BE PREPARED
FOR NODE-POCALYPSE
@tomekcejner
THE PRESENTER
TOMEK CEJNER
@tomekcejner
APOCALYPSE?
JavaScript
Any application that can be written in JavaScript,
will eventually be written in JavaScript.
http://blog.codinghorror.com/the-principle-of-least-power/
Jeff Atwood, 2007
How to build mobile API with Node.js
CREATED IN 10 DAYS
DIFFICULT CHILDHOOD
FUNCTIONAL
DYNAMIC
How to build mobile API with Node.js
IN 90’S EVERYBODY NEED A WEBSITE
http://www.amazon.com/
http://www.lego.com/
NOW ITS 2010’S
EVERYBODY NEEDS MOBILE APP
How to build mobile API with Node.js
How to build mobile API with Node.js
How to build mobile API with Node.js
How to build mobile API with Node.js
THAT’S ALL
THANK YOU!
BUT, IF…
API
How to build mobile API with Node.js
NO API
NO PUBLIC API
NO MOBILE PUBLIC API
ARE YOU PREPARED?
WHAT MAKES API MOBILE?
LOW BANDWIDTH
HIGH LATENCY
NETWORK CONDITIONS VARY
Mobile device is
SEND ONLY WHAT IS NEEDED
SCREEN-ORIENTED
NO CRUD-OVER-AIR
AVOID MULTIPLE ROUNDTRIPS
CAUSED BY LAZY DESIGN
EVERY REQUEST COUNTS
VERSIONING
OR KEEP STABLE CONTRACT
SECURITY
AUTHENTICATION
TRANSIT
API ABUSE
ANALYTICS
Our approach
PLATFORM APIs
MOBILE API
INTRODUCING
Mobster
OAUTH 2.0
AUTHORIZATION
API KEYS
Access control
DATA AGGREGATION
DATA FILTERING
ANTI-CORRUPTION LAYER
Translation
PUSH NOTIFICATIONS GATEWAY
Mobile features
ENTER
EVENT-DRIVEN
NETWORK PROGRAMS
JAVASCRIPT
Node.js is
V8
LIBUV HTTP-PARSER
JS STANDARD LIBRARY
WHY NODE.JS?
DB
SERVICE
REQUEST
REQUEST
REQUEST
REQUEST
TRADITIONAL WAY
WHAT WEB SERVERS DO MOST THE TIME?
THEY WAIT
WHAT THREADS DO MOST THE TIME?
THEY SUCK
EVENT
LOOP
I/O
REGISTER CALLBACK
OPERATION COMPLETE
YOUR
CODE
YOUR
CODE
LESS THREADS
LESS MEMORY OVERHEAD
LESS COMPUTATION (!)
NODE.JS SURVIVAL KIT
Editors
UNIT TESTING
NodeUnit
NodeUnit + Expect.js
NodeUnit
NodeUnit
Mocha
Mocha
PACKAGE MANAGEMENT
How to build mobile API with Node.js
How to build mobile API with Node.js
pom.xml
How to build mobile API with Node.js
CHECK NODE_MODULES TO SCM
WEB FRAMEWORKS
How to build mobile API with Node.js
How to build mobile API with Node.js
How to build mobile API with Node.js
MIDDLEWARE
How to build mobile API with Node.js
tomek@dev_laptop$ git push
appuser@server$ git pull
appuser@server$ kill process_num
appuser@server$ node myapp.js
DEPLOYMENT
MANAGEMENT
WITH PM2
https://github.com/unitech/pm2
RUN
RESTART
PROCESS LIST
MONITORING
ZERO-DOWNTIME RELOAD
HEALTH CHECK API ENDPOINT
LOG BROWSING
LINUX STARTUP SCRIPTS
Fluff
Automate
ANSIBLE
SPEAKS YOUR LANGUAGE
AGENTLESS
Ansible
How to build mobile API with Node.js
CODE
GOOGLE: JAVASCRIPT GARDEN
http://bonsaiden.github.io/JavaScript-Garden/
JAVASCRIPT QUIRKS
JSLINT & JSHINT TO RESCUE
How to build mobile API with Node.js
ASYNCHRONOUS PROGRAMMING,
M**********R
How to build mobile API with Node.js
How to build mobile API with Node.js
How to build mobile API with Node.js
ASYNC TO RESCUE
https://github.com/caolan/async
https://github.com/caolan/async
TO NODE OR NOT TO NODE
DEVELOP FAST
DEPLOY FAST
IT’S JAVASCRIPT
IT’S JAVASCRIPT
NOT SO MATURE
NOT FOR CPU-INTENSIVE JOBS
THANK YOU

More Related Content

What's hot (20)

Building mobile apps using Phonegap
Building mobile apps using PhonegapBuilding mobile apps using Phonegap
Building mobile apps using Phonegap
Mohammad Shoriful Islam Ronju
 
Progressive Web Apps: The Breakdown
Progressive Web Apps: The BreakdownProgressive Web Apps: The Breakdown
Progressive Web Apps: The Breakdown
UXDXConf
 
PhoneGap: a brief history and apologia
PhoneGap: a brief history and apologiaPhoneGap: a brief history and apologia
PhoneGap: a brief history and apologia
lorinbeer
 
The Fine Print of iOS Development
The Fine Print of iOS DevelopmentThe Fine Print of iOS Development
The Fine Print of iOS Development
Cory Wiles
 
AppStrom
AppStromAppStrom
AppStrom
AppStrom
 
Using HTML5 to Build Mobile Apps
Using HTML5 to Build Mobile AppsUsing HTML5 to Build Mobile Apps
Using HTML5 to Build Mobile Apps
Todd Anglin
 
Of innovation and impatience - Future Decoded 2015
Of innovation and impatience - Future Decoded 2015Of innovation and impatience - Future Decoded 2015
Of innovation and impatience - Future Decoded 2015
Christian Heilmann
 
Mobile twin cities
Mobile twin citiesMobile twin cities
Mobile twin cities
DaveLaFontaine
 
アプリ開発支援サービス「アプリカン」 - HTML5 Experts Night 2013年8月23日
アプリ開発支援サービス「アプリカン」 - HTML5 Experts Night 2013年8月23日アプリ開発支援サービス「アプリカン」 - HTML5 Experts Night 2013年8月23日
アプリ開発支援サービス「アプリカン」 - HTML5 Experts Night 2013年8月23日
Futomi Hatano
 
Business of APIs - Introduction
Business of APIs - IntroductionBusiness of APIs - Introduction
Business of APIs - Introduction
aubs
 
Introduction to Xamarin
Introduction to XamarinIntroduction to Xamarin
Introduction to Xamarin
Shravan Kumar Kasagoni
 
Why we choose Skype ?
Why we choose Skype ?Why we choose Skype ?
Why we choose Skype ?
mohamed hadrich
 
Workshop: the mobile web and the future of your council's website #BPCW11
Workshop: the mobile web and the future of your council's website #BPCW11Workshop: the mobile web and the future of your council's website #BPCW11
Workshop: the mobile web and the future of your council's website #BPCW11
Headstar
 
The modern PWA Cheat Sheet
The modern PWA Cheat SheetThe modern PWA Cheat Sheet
The modern PWA Cheat Sheet
Maximiliano Firtman
 
Voice interfaces
Voice interfacesVoice interfaces
Voice interfaces
Sam Machin
 
Your Browser is Your SDK
Your Browser is Your SDKYour Browser is Your SDK
Your Browser is Your SDK
mwbrooks
 
Developing for Wearables with Xamarin
Developing for Wearables with XamarinDeveloping for Wearables with Xamarin
Developing for Wearables with Xamarin
Gert Cominotto
 
Android Wear Applications in C# with Xamarin
Android Wear Applications in C# with XamarinAndroid Wear Applications in C# with Xamarin
Android Wear Applications in C# with Xamarin
James Montemagno
 
Dawn of the Devices
Dawn of the DevicesDawn of the Devices
Dawn of the Devices
mwbrooks
 
MOBILE DEVELOPMENT with HTML, CSS and JS
MOBILE DEVELOPMENT with HTML, CSS and JSMOBILE DEVELOPMENT with HTML, CSS and JS
MOBILE DEVELOPMENT with HTML, CSS and JS
Sperasoft
 
Progressive Web Apps: The Breakdown
Progressive Web Apps: The BreakdownProgressive Web Apps: The Breakdown
Progressive Web Apps: The Breakdown
UXDXConf
 
PhoneGap: a brief history and apologia
PhoneGap: a brief history and apologiaPhoneGap: a brief history and apologia
PhoneGap: a brief history and apologia
lorinbeer
 
The Fine Print of iOS Development
The Fine Print of iOS DevelopmentThe Fine Print of iOS Development
The Fine Print of iOS Development
Cory Wiles
 
Using HTML5 to Build Mobile Apps
Using HTML5 to Build Mobile AppsUsing HTML5 to Build Mobile Apps
Using HTML5 to Build Mobile Apps
Todd Anglin
 
Of innovation and impatience - Future Decoded 2015
Of innovation and impatience - Future Decoded 2015Of innovation and impatience - Future Decoded 2015
Of innovation and impatience - Future Decoded 2015
Christian Heilmann
 
アプリ開発支援サービス「アプリカン」 - HTML5 Experts Night 2013年8月23日
アプリ開発支援サービス「アプリカン」 - HTML5 Experts Night 2013年8月23日アプリ開発支援サービス「アプリカン」 - HTML5 Experts Night 2013年8月23日
アプリ開発支援サービス「アプリカン」 - HTML5 Experts Night 2013年8月23日
Futomi Hatano
 
Business of APIs - Introduction
Business of APIs - IntroductionBusiness of APIs - Introduction
Business of APIs - Introduction
aubs
 
Workshop: the mobile web and the future of your council's website #BPCW11
Workshop: the mobile web and the future of your council's website #BPCW11Workshop: the mobile web and the future of your council's website #BPCW11
Workshop: the mobile web and the future of your council's website #BPCW11
Headstar
 
Voice interfaces
Voice interfacesVoice interfaces
Voice interfaces
Sam Machin
 
Your Browser is Your SDK
Your Browser is Your SDKYour Browser is Your SDK
Your Browser is Your SDK
mwbrooks
 
Developing for Wearables with Xamarin
Developing for Wearables with XamarinDeveloping for Wearables with Xamarin
Developing for Wearables with Xamarin
Gert Cominotto
 
Android Wear Applications in C# with Xamarin
Android Wear Applications in C# with XamarinAndroid Wear Applications in C# with Xamarin
Android Wear Applications in C# with Xamarin
James Montemagno
 
Dawn of the Devices
Dawn of the DevicesDawn of the Devices
Dawn of the Devices
mwbrooks
 
MOBILE DEVELOPMENT with HTML, CSS and JS
MOBILE DEVELOPMENT with HTML, CSS and JSMOBILE DEVELOPMENT with HTML, CSS and JS
MOBILE DEVELOPMENT with HTML, CSS and JS
Sperasoft
 

Viewers also liked (16)

Jordi Romero Api for-the-mobile-era
Jordi Romero Api for-the-mobile-eraJordi Romero Api for-the-mobile-era
Jordi Romero Api for-the-mobile-era
.toster
 
Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano
Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and CapistranoDevelop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano
Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano
Errazudin Ishak
 
Mobile API Design Techniques
Mobile API Design TechniquesMobile API Design Techniques
Mobile API Design Techniques
Trieu Nguyen
 
Pragmatic Git workflow
Pragmatic Git workflowPragmatic Git workflow
Pragmatic Git workflow
Tomek Cejner
 
Creating an Effective Mobile API
Creating an Effective Mobile API Creating an Effective Mobile API
Creating an Effective Mobile API
Nick DeNardis
 
Data To Go: Mobile API Design (Lightning Talk)
Data To Go: Mobile API Design (Lightning Talk)Data To Go: Mobile API Design (Lightning Talk)
Data To Go: Mobile API Design (Lightning Talk)
Chuck Greb
 
Designing an API for Mobile
Designing an API for MobileDesigning an API for Mobile
Designing an API for Mobile
SocialRadar
 
Api mobile first
Api mobile firstApi mobile first
Api mobile first
Chris Saez
 
Mobile API: Design & Techniques
Mobile API: Design & TechniquesMobile API: Design & Techniques
Mobile API: Design & Techniques
Fred Brunel
 
Mobile Api and Caching
Mobile Api and CachingMobile Api and Caching
Mobile Api and Caching
New Relic
 
Data to Go: Mobile API Design (SXSW)
Data to Go: Mobile API Design (SXSW)Data to Go: Mobile API Design (SXSW)
Data to Go: Mobile API Design (SXSW)
Chuck Greb
 
Data to Go: Mobile API Design
Data to Go: Mobile API DesignData to Go: Mobile API Design
Data to Go: Mobile API Design
Chuck Greb
 
Build a REST API for your Mobile Apps using Node.js
Build a REST API for your Mobile Apps using Node.jsBuild a REST API for your Mobile Apps using Node.js
Build a REST API for your Mobile Apps using Node.js
Stormpath
 
We we should be Mobile API - First, by Brad Hipps
We we should be Mobile API - First, by Brad HippsWe we should be Mobile API - First, by Brad Hipps
We we should be Mobile API - First, by Brad Hipps
Puerto Rico Tech Summit
 
Designing API for mobile apps (MobileWarsaw 19.01.2015)
Designing API for mobile apps (MobileWarsaw 19.01.2015)Designing API for mobile apps (MobileWarsaw 19.01.2015)
Designing API for mobile apps (MobileWarsaw 19.01.2015)
Wojtek Erbetowski
 
Build Features, Not Apps
Build Features, Not AppsBuild Features, Not Apps
Build Features, Not Apps
Natasha Murashev
 
Jordi Romero Api for-the-mobile-era
Jordi Romero Api for-the-mobile-eraJordi Romero Api for-the-mobile-era
Jordi Romero Api for-the-mobile-era
.toster
 
Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano
Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and CapistranoDevelop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano
Develop and Deploy your Mobile API with Rails, Nginx, Unicorn and Capistrano
Errazudin Ishak
 
Mobile API Design Techniques
Mobile API Design TechniquesMobile API Design Techniques
Mobile API Design Techniques
Trieu Nguyen
 
Pragmatic Git workflow
Pragmatic Git workflowPragmatic Git workflow
Pragmatic Git workflow
Tomek Cejner
 
Creating an Effective Mobile API
Creating an Effective Mobile API Creating an Effective Mobile API
Creating an Effective Mobile API
Nick DeNardis
 
Data To Go: Mobile API Design (Lightning Talk)
Data To Go: Mobile API Design (Lightning Talk)Data To Go: Mobile API Design (Lightning Talk)
Data To Go: Mobile API Design (Lightning Talk)
Chuck Greb
 
Designing an API for Mobile
Designing an API for MobileDesigning an API for Mobile
Designing an API for Mobile
SocialRadar
 
Api mobile first
Api mobile firstApi mobile first
Api mobile first
Chris Saez
 
Mobile API: Design & Techniques
Mobile API: Design & TechniquesMobile API: Design & Techniques
Mobile API: Design & Techniques
Fred Brunel
 
Mobile Api and Caching
Mobile Api and CachingMobile Api and Caching
Mobile Api and Caching
New Relic
 
Data to Go: Mobile API Design (SXSW)
Data to Go: Mobile API Design (SXSW)Data to Go: Mobile API Design (SXSW)
Data to Go: Mobile API Design (SXSW)
Chuck Greb
 
Data to Go: Mobile API Design
Data to Go: Mobile API DesignData to Go: Mobile API Design
Data to Go: Mobile API Design
Chuck Greb
 
Build a REST API for your Mobile Apps using Node.js
Build a REST API for your Mobile Apps using Node.jsBuild a REST API for your Mobile Apps using Node.js
Build a REST API for your Mobile Apps using Node.js
Stormpath
 
We we should be Mobile API - First, by Brad Hipps
We we should be Mobile API - First, by Brad HippsWe we should be Mobile API - First, by Brad Hipps
We we should be Mobile API - First, by Brad Hipps
Puerto Rico Tech Summit
 
Designing API for mobile apps (MobileWarsaw 19.01.2015)
Designing API for mobile apps (MobileWarsaw 19.01.2015)Designing API for mobile apps (MobileWarsaw 19.01.2015)
Designing API for mobile apps (MobileWarsaw 19.01.2015)
Wojtek Erbetowski
 

Similar to How to build mobile API with Node.js (20)

JanusCon - Building Native Mobile Apps with WebRTC
JanusCon - Building Native Mobile Apps with WebRTCJanusCon - Building Native Mobile Apps with WebRTC
JanusCon - Building Native Mobile Apps with WebRTC
Dan Jenkins
 
Optimizing for Change (Henrik Joreteg)
Optimizing for Change (Henrik Joreteg)Optimizing for Change (Henrik Joreteg)
Optimizing for Change (Henrik Joreteg)
Future Insights
 
Brian Le Roux Presentation Introducing Phone Gap
Brian Le Roux Presentation Introducing Phone GapBrian Le Roux Presentation Introducing Phone Gap
Brian Le Roux Presentation Introducing Phone Gap
Ajax Experience 2009
 
Introduction to PhoneGap
Introduction to PhoneGapIntroduction to PhoneGap
Introduction to PhoneGap
Quang Minh Dao
 
Phonegap
PhonegapPhonegap
Phonegap
Quang Minh Dao
 
Mobile Web Mega Trend 2010
Mobile Web Mega Trend 2010Mobile Web Mega Trend 2010
Mobile Web Mega Trend 2010
Manyoung Cho
 
Beyond Squishy: The Principles of Adaptive Design
Beyond Squishy: The Principles of Adaptive DesignBeyond Squishy: The Principles of Adaptive Design
Beyond Squishy: The Principles of Adaptive Design
Brad Frost
 
WebKit, why it matters (PDF version)
WebKit, why it matters (PDF version)WebKit, why it matters (PDF version)
WebKit, why it matters (PDF version)
Kenneth Rohde Christiansen
 
Georges Chitiga - Introduction to Phonegap - HTML5 & JS to native mobile app
Georges Chitiga - Introduction to Phonegap - HTML5 & JS to native mobile appGeorges Chitiga - Introduction to Phonegap - HTML5 & JS to native mobile app
Georges Chitiga - Introduction to Phonegap - HTML5 & JS to native mobile app
Codecamp Romania
 
Web2013
Web2013Web2013
Web2013
Sean Yo
 
HTML5 for mobile - DiGi Challenge for Change
HTML5 for mobile - DiGi Challenge for ChangeHTML5 for mobile - DiGi Challenge for Change
HTML5 for mobile - DiGi Challenge for Change
Jan Jongboom
 
Aleksandar Vacić - iOS App Development iz Srbije
Aleksandar Vacić - iOS App Development iz SrbijeAleksandar Vacić - iOS App Development iz Srbije
Aleksandar Vacić - iOS App Development iz Srbije
Mobile Monday Srbija
 
Philly ete-2011
Philly ete-2011Philly ete-2011
Philly ete-2011
davyjones
 
Cordova + Ionic + MobileFirst
Cordova + Ionic + MobileFirstCordova + Ionic + MobileFirst
Cordova + Ionic + MobileFirst
Raymond Camden
 
Developing cross platform mobile applications with phone gap for windows phone
Developing cross platform mobile applications with phone gap for windows phoneDeveloping cross platform mobile applications with phone gap for windows phone
Developing cross platform mobile applications with phone gap for windows phone
Colin Eberhardt
 
Phonegap
PhonegapPhonegap
Phonegap
Tim Kim
 
Maximiliano Firtman - Разработка приложений с помощью PhoneGap
Maximiliano Firtman - Разработка приложений с помощью PhoneGap Maximiliano Firtman - Разработка приложений с помощью PhoneGap
Maximiliano Firtman - Разработка приложений с помощью PhoneGap
.toster
 
PhoneGap mobile development
PhoneGap mobile developmentPhoneGap mobile development
PhoneGap mobile development
Maximiliano Firtman
 
Mobile Development with PhoneGap
Mobile Development with PhoneGapMobile Development with PhoneGap
Mobile Development with PhoneGap
Joshua Johnson
 
AppsWorld 2015 - Cross Platform Native Applications in JavaScript
AppsWorld 2015 - Cross Platform Native Applications in JavaScriptAppsWorld 2015 - Cross Platform Native Applications in JavaScript
AppsWorld 2015 - Cross Platform Native Applications in JavaScript
Jason Kneen
 
JanusCon - Building Native Mobile Apps with WebRTC
JanusCon - Building Native Mobile Apps with WebRTCJanusCon - Building Native Mobile Apps with WebRTC
JanusCon - Building Native Mobile Apps with WebRTC
Dan Jenkins
 
Optimizing for Change (Henrik Joreteg)
Optimizing for Change (Henrik Joreteg)Optimizing for Change (Henrik Joreteg)
Optimizing for Change (Henrik Joreteg)
Future Insights
 
Brian Le Roux Presentation Introducing Phone Gap
Brian Le Roux Presentation Introducing Phone GapBrian Le Roux Presentation Introducing Phone Gap
Brian Le Roux Presentation Introducing Phone Gap
Ajax Experience 2009
 
Introduction to PhoneGap
Introduction to PhoneGapIntroduction to PhoneGap
Introduction to PhoneGap
Quang Minh Dao
 
Mobile Web Mega Trend 2010
Mobile Web Mega Trend 2010Mobile Web Mega Trend 2010
Mobile Web Mega Trend 2010
Manyoung Cho
 
Beyond Squishy: The Principles of Adaptive Design
Beyond Squishy: The Principles of Adaptive DesignBeyond Squishy: The Principles of Adaptive Design
Beyond Squishy: The Principles of Adaptive Design
Brad Frost
 
Georges Chitiga - Introduction to Phonegap - HTML5 & JS to native mobile app
Georges Chitiga - Introduction to Phonegap - HTML5 & JS to native mobile appGeorges Chitiga - Introduction to Phonegap - HTML5 & JS to native mobile app
Georges Chitiga - Introduction to Phonegap - HTML5 & JS to native mobile app
Codecamp Romania
 
HTML5 for mobile - DiGi Challenge for Change
HTML5 for mobile - DiGi Challenge for ChangeHTML5 for mobile - DiGi Challenge for Change
HTML5 for mobile - DiGi Challenge for Change
Jan Jongboom
 
Aleksandar Vacić - iOS App Development iz Srbije
Aleksandar Vacić - iOS App Development iz SrbijeAleksandar Vacić - iOS App Development iz Srbije
Aleksandar Vacić - iOS App Development iz Srbije
Mobile Monday Srbija
 
Philly ete-2011
Philly ete-2011Philly ete-2011
Philly ete-2011
davyjones
 
Cordova + Ionic + MobileFirst
Cordova + Ionic + MobileFirstCordova + Ionic + MobileFirst
Cordova + Ionic + MobileFirst
Raymond Camden
 
Developing cross platform mobile applications with phone gap for windows phone
Developing cross platform mobile applications with phone gap for windows phoneDeveloping cross platform mobile applications with phone gap for windows phone
Developing cross platform mobile applications with phone gap for windows phone
Colin Eberhardt
 
Phonegap
PhonegapPhonegap
Phonegap
Tim Kim
 
Maximiliano Firtman - Разработка приложений с помощью PhoneGap
Maximiliano Firtman - Разработка приложений с помощью PhoneGap Maximiliano Firtman - Разработка приложений с помощью PhoneGap
Maximiliano Firtman - Разработка приложений с помощью PhoneGap
.toster
 
Mobile Development with PhoneGap
Mobile Development with PhoneGapMobile Development with PhoneGap
Mobile Development with PhoneGap
Joshua Johnson
 
AppsWorld 2015 - Cross Platform Native Applications in JavaScript
AppsWorld 2015 - Cross Platform Native Applications in JavaScriptAppsWorld 2015 - Cross Platform Native Applications in JavaScript
AppsWorld 2015 - Cross Platform Native Applications in JavaScript
Jason Kneen
 

How to build mobile API with Node.js