SlideShare a Scribd company logo
Hello world - intro to node js
HELLO WORLD
Jeff Andersen
Developer
Twitter: @jeffandersen
Email: jeff@goinstant.com
Hello world - intro to node js
What is Node.js?
•

In a nutshell: server-side JavaScript

•

Used to build scalable network applications

•

Built on Google’s v8 JavaScript engine

•

Event-driven, non-blocking (asynchronous) I/O
Who uses it?
Installing Node.js
•

Visit nodejs.org

•

Download the package/installer and run

•

Alternatively: use nvm - Node Version Manager

(Similar to Ruby’s RVM)

https://github.com/creationix/nvm
Test out the repl
•

From the command line type `node`

•

Type out commands and hit enter
Use cases
•

REST APIs

•

Streaming data

•

High concurrency

•

Leveraging UNIX tools

•

Realtime applications
Event Driven
Event Driven
Sync vs Async
Synchronous
(Blocking)
Asynchronous
(Non-Blocking)
Asynchronous
(Non-Blocking)
•

Node is built for async i/o

•

Sometimes difficult to understand

•

Callback soup
Let’s run it
HTTP Server
5 lines of code
Let’s run it
HTTP Server
Community / Ecosystem

http://notinventedhe.re/on/2011-7-26
•

npmjs.org

•

Open source software

•

Official package manager for Node.js

•

Nearly 55 thousand packages and almost 2.5
million downloads per day

•

package.json
Package.json
npm install
Recommended Modules
•

async - Higher-order functions and common patterns for
asynchronous code

•

lodash - A utility library delivering consistency, customization,
performance, & extras.

•

express - Sinatra inspired web development framework

•

mocha - simple, flexible, fun test framework

•

pg - PostgreSQL client

•

redis - Redis client
Example app
Example app
Basic REST api
What do we need?
•

HTTP server

•

Postgres database

•

Postgres client

•

JSON formatted responses
We have an HTTP server
Problems?
•

One handler replying to every request

•

Missing
•

Routing/URL parameters

•

Response formatting
Introducing Express
•

npm install express

•

Sinatra style web framework

•

Simple verb-based request handlers

•

Full-featured router
•

•

body parser, url parameters, query string parsing

Automatic response formatting
Same functionality
Let’s code
What could be added?
•

OAuth middleware
•

Middleware: A function that processes a request, typically on
an interim basis to the final request handler.

•

Permissions & token scopes

•

JSON web hooks
Twitter recommendations
•

@izs - Isaac Schlueter, Creator of NPM & Node core gate keeper

•

@eranhammer - Eran Hammer, Walmart Labs & OSS contributor

•

@substack - James Halliday, Node module authoring machine

•

@tjholowaychuk - TJ Holowaychuk, Author: Express, Mocha, etc

•

@igrigorik - Ilya Grigorik, Developer advocate at Google

•

@jeresig - John Resig, Creator of jQuery

•

@goinstant - Realtime Collaboration API and Backend
Hello world - intro to node js
Ad

Recommended

JSFoo-2017 Takeaways
JSFoo-2017 Takeaways
Mir Ali
 
10 tips to make your ASP.NET Apps Faster
10 tips to make your ASP.NET Apps Faster
Brij Mishra
 
Next generation frontend tooling
Next generation frontend tooling
pksjce
 
Getting Started with ASP.NET 5
Getting Started with ASP.NET 5
Brij Mishra
 
Conquering AngularJS Limitations
Conquering AngularJS Limitations
Valeri Karpov
 
Lessons in Open Source from the MongooseJS ODM
Lessons in Open Source from the MongooseJS ODM
Valeri Karpov
 
MongoDB MEAN Stack Webinar October 7, 2015
MongoDB MEAN Stack Webinar October 7, 2015
Valeri Karpov
 
Unit Testing in JavaScript
Unit Testing in JavaScript
Rob Scaduto
 
Afrimadoni the power of docker
Afrimadoni the power of docker
PHP Indonesia
 
Automating security with PowerShell
Automating security with PowerShell
Jaap Brasser
 
TDD a REST API With Node.js and MongoDB
TDD a REST API With Node.js and MongoDB
Valeri Karpov
 
Making maven and grunt play nice
Making maven and grunt play nice
Zoran Nikolovski
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web Development
Irfan Maulana
 
Breaking the eggshell: From .NET to Node.js
Breaking the eggshell: From .NET to Node.js
Barbara Fusinska
 
Automating JavaScript testing with Jasmine and Perl
Automating JavaScript testing with Jasmine and Perl
nohuhu
 
Chat automation in a Modern IT environment
Chat automation in a Modern IT environment
Jaap Brasser
 
Apply chat automation today - work smarter tomorrow
Apply chat automation today - work smarter tomorrow
Jaap Brasser
 
Aspect j introduction for non-programmers
Aspect j introduction for non-programmers
Tamas Rev
 
Why you should switch to Cypress for modern web testing?
Why you should switch to Cypress for modern web testing?
Shivam Bharadwaj
 
Rails automatic test driven development
Rails automatic test driven development
tyler4long
 
Apply chat automation today - work smarter tomorrow
Apply chat automation today - work smarter tomorrow
Jaap Brasser
 
Saving Time By Testing With Jest
Saving Time By Testing With Jest
Ben McCormick
 
Dev-Friendly Ops
Dev-Friendly Ops
Josh Schramm
 
Power shell v3 session1
Power shell v3 session1
Vladimir Márquez
 
Chat automation in a modern it environment
Chat automation in a modern it environment
Jaap Brasser
 
Why ruby and rails
Why ruby and rails
Reuven Lerner
 
The MEAN Stack
The MEAN Stack
Md. Ziaul Haq
 
MEAN Stack WeNode Barcelona Workshop
MEAN Stack WeNode Barcelona Workshop
Valeri Karpov
 
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
Tech in Asia ID
 
Beginners Node.js
Beginners Node.js
Khaled Mosharraf
 

More Related Content

What's hot (18)

Afrimadoni the power of docker
Afrimadoni the power of docker
PHP Indonesia
 
Automating security with PowerShell
Automating security with PowerShell
Jaap Brasser
 
TDD a REST API With Node.js and MongoDB
TDD a REST API With Node.js and MongoDB
Valeri Karpov
 
Making maven and grunt play nice
Making maven and grunt play nice
Zoran Nikolovski
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web Development
Irfan Maulana
 
Breaking the eggshell: From .NET to Node.js
Breaking the eggshell: From .NET to Node.js
Barbara Fusinska
 
Automating JavaScript testing with Jasmine and Perl
Automating JavaScript testing with Jasmine and Perl
nohuhu
 
Chat automation in a Modern IT environment
Chat automation in a Modern IT environment
Jaap Brasser
 
Apply chat automation today - work smarter tomorrow
Apply chat automation today - work smarter tomorrow
Jaap Brasser
 
Aspect j introduction for non-programmers
Aspect j introduction for non-programmers
Tamas Rev
 
Why you should switch to Cypress for modern web testing?
Why you should switch to Cypress for modern web testing?
Shivam Bharadwaj
 
Rails automatic test driven development
Rails automatic test driven development
tyler4long
 
Apply chat automation today - work smarter tomorrow
Apply chat automation today - work smarter tomorrow
Jaap Brasser
 
Saving Time By Testing With Jest
Saving Time By Testing With Jest
Ben McCormick
 
Dev-Friendly Ops
Dev-Friendly Ops
Josh Schramm
 
Power shell v3 session1
Power shell v3 session1
Vladimir Márquez
 
Chat automation in a modern it environment
Chat automation in a modern it environment
Jaap Brasser
 
Why ruby and rails
Why ruby and rails
Reuven Lerner
 
Afrimadoni the power of docker
Afrimadoni the power of docker
PHP Indonesia
 
Automating security with PowerShell
Automating security with PowerShell
Jaap Brasser
 
TDD a REST API With Node.js and MongoDB
TDD a REST API With Node.js and MongoDB
Valeri Karpov
 
Making maven and grunt play nice
Making maven and grunt play nice
Zoran Nikolovski
 
PHP Indonesia - Nodejs Web Development
PHP Indonesia - Nodejs Web Development
Irfan Maulana
 
Breaking the eggshell: From .NET to Node.js
Breaking the eggshell: From .NET to Node.js
Barbara Fusinska
 
Automating JavaScript testing with Jasmine and Perl
Automating JavaScript testing with Jasmine and Perl
nohuhu
 
Chat automation in a Modern IT environment
Chat automation in a Modern IT environment
Jaap Brasser
 
Apply chat automation today - work smarter tomorrow
Apply chat automation today - work smarter tomorrow
Jaap Brasser
 
Aspect j introduction for non-programmers
Aspect j introduction for non-programmers
Tamas Rev
 
Why you should switch to Cypress for modern web testing?
Why you should switch to Cypress for modern web testing?
Shivam Bharadwaj
 
Rails automatic test driven development
Rails automatic test driven development
tyler4long
 
Apply chat automation today - work smarter tomorrow
Apply chat automation today - work smarter tomorrow
Jaap Brasser
 
Saving Time By Testing With Jest
Saving Time By Testing With Jest
Ben McCormick
 
Chat automation in a modern it environment
Chat automation in a modern it environment
Jaap Brasser
 

Similar to Hello world - intro to node js (20)

The MEAN Stack
The MEAN Stack
Md. Ziaul Haq
 
MEAN Stack WeNode Barcelona Workshop
MEAN Stack WeNode Barcelona Workshop
Valeri Karpov
 
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
Tech in Asia ID
 
Beginners Node.js
Beginners Node.js
Khaled Mosharraf
 
Understand How Node.js and Core Features Works
Understand How Node.js and Core Features Works
Hengki Sihombing
 
NodeJS - Server Side JS
NodeJS - Server Side JS
Ganesh Kondal
 
Node.js for beginner
Node.js for beginner
Sarunyhot Suwannachoti
 
20120306 dublin js
20120306 dublin js
Richard Rodger
 
A brief intro to nodejs
A brief intro to nodejs
Jay Liu
 
You Got React.js in My PHP
You Got React.js in My PHP
Taylor Lovett
 
Node.js to the rescue
Node.js to the rescue
Marko Heijnen
 
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
Christian Joudrey
 
Real time web
Real time web
Medhat Dawoud
 
What is Node.js
What is Node.js
mohamed hadrich
 
introduction to node.js
introduction to node.js
orkaplan
 
Developing and Testing a MongoDB and Node.js REST API
Developing and Testing a MongoDB and Node.js REST API
All Things Open
 
APIs distribuidos con alta escalabilidad
APIs distribuidos con alta escalabilidad
Software Guru
 
SGCE 2015 REST APIs
SGCE 2015 REST APIs
Domingo Suarez Torres
 
Distributed app development with nodejs and zeromq
Distributed app development with nodejs and zeromq
Ruben Tan
 
MEAN Stack WeNode Barcelona Workshop
MEAN Stack WeNode Barcelona Workshop
Valeri Karpov
 
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
"You Don't Know NODE.JS" by Hengki Mardongan Sihombing (Urbanhire)
Tech in Asia ID
 
Understand How Node.js and Core Features Works
Understand How Node.js and Core Features Works
Hengki Sihombing
 
NodeJS - Server Side JS
NodeJS - Server Side JS
Ganesh Kondal
 
A brief intro to nodejs
A brief intro to nodejs
Jay Liu
 
You Got React.js in My PHP
You Got React.js in My PHP
Taylor Lovett
 
Node.js to the rescue
Node.js to the rescue
Marko Heijnen
 
Introduction to Node.js: What, why and how?
Introduction to Node.js: What, why and how?
Christian Joudrey
 
introduction to node.js
introduction to node.js
orkaplan
 
Developing and Testing a MongoDB and Node.js REST API
Developing and Testing a MongoDB and Node.js REST API
All Things Open
 
APIs distribuidos con alta escalabilidad
APIs distribuidos con alta escalabilidad
Software Guru
 
Distributed app development with nodejs and zeromq
Distributed app development with nodejs and zeromq
Ruben Tan
 
Ad

More from Refresh Annapolis Valley (20)

IP Matters
IP Matters
Refresh Annapolis Valley
 
3 Essential Wordpress Tips
3 Essential Wordpress Tips
Refresh Annapolis Valley
 
Wordpress introduction
Wordpress introduction
Refresh Annapolis Valley
 
UX Fist Fighting - Designing For Usability
UX Fist Fighting - Designing For Usability
Refresh Annapolis Valley
 
STEAM Powered! MakerSpace / FabLab @AcadiaU
STEAM Powered! MakerSpace / FabLab @AcadiaU
Refresh Annapolis Valley
 
The Ag + Tech Opportunity
The Ag + Tech Opportunity
Refresh Annapolis Valley
 
Emergent Learning & New Media
Emergent Learning & New Media
Refresh Annapolis Valley
 
Just in time mentors
Just in time mentors
Refresh Annapolis Valley
 
ValleyEvents.ca
ValleyEvents.ca
Refresh Annapolis Valley
 
Predictive analytics in the agriculture industry
Predictive analytics in the agriculture industry
Refresh Annapolis Valley
 
Mobile development frameworks
Mobile development frameworks
Refresh Annapolis Valley
 
Just in time mentors
Just in time mentors
Refresh Annapolis Valley
 
Players and Builders: Digital Games and University Learning
Players and Builders: Digital Games and University Learning
Refresh Annapolis Valley
 
Building Startup Communities: Annapolis Valley
Building Startup Communities: Annapolis Valley
Refresh Annapolis Valley
 
New Media Legal Q&A
New Media Legal Q&A
Refresh Annapolis Valley
 
She++
She++
Refresh Annapolis Valley
 
Valley Community Fiber Network
Valley Community Fiber Network
Refresh Annapolis Valley
 
Valley Community Fiber Network
Valley Community Fiber Network
Refresh Annapolis Valley
 
Coldfusion with Keith Diehl
Coldfusion with Keith Diehl
Refresh Annapolis Valley
 
Valley Family Fun
Valley Family Fun
Refresh Annapolis Valley
 
UX Fist Fighting - Designing For Usability
UX Fist Fighting - Designing For Usability
Refresh Annapolis Valley
 
STEAM Powered! MakerSpace / FabLab @AcadiaU
STEAM Powered! MakerSpace / FabLab @AcadiaU
Refresh Annapolis Valley
 
Predictive analytics in the agriculture industry
Predictive analytics in the agriculture industry
Refresh Annapolis Valley
 
Players and Builders: Digital Games and University Learning
Players and Builders: Digital Games and University Learning
Refresh Annapolis Valley
 
Building Startup Communities: Annapolis Valley
Building Startup Communities: Annapolis Valley
Refresh Annapolis Valley
 
Ad

Recently uploaded (20)

The Future of AI Agent Development Trends to Watch.pptx
The Future of AI Agent Development Trends to Watch.pptx
Lisa ward
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
 
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
cnc-processing-centers-centateq-p-110-en.pdf
cnc-processing-centers-centateq-p-110-en.pdf
AmirStern2
 
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Safe Software
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
“Key Requirements to Successfully Implement Generative AI in Edge Devices—Opt...
“Key Requirements to Successfully Implement Generative AI in Edge Devices—Opt...
Edge AI and Vision Alliance
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
 
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
The Future of AI Agent Development Trends to Watch.pptx
The Future of AI Agent Development Trends to Watch.pptx
Lisa ward
 
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Seminar: Perspectives on Passkeys & Consumer Adoption.pptx
FIDO Alliance
 
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
 
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Coordinated Disclosure for ML - What's Different and What's the Same.pdf
Priyanka Aash
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
cnc-processing-centers-centateq-p-110-en.pdf
cnc-processing-centers-centateq-p-110-en.pdf
AmirStern2
 
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Powering Multi-Page Web Applications Using Flow Apps and FME Data Streaming
Safe Software
 
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Seminar: New Data: Passkey Adoption in the Workforce.pptx
FIDO Alliance
 
“Key Requirements to Successfully Implement Generative AI in Edge Devices—Opt...
“Key Requirements to Successfully Implement Generative AI in Edge Devices—Opt...
Edge AI and Vision Alliance
 
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Seminar: Evolving Landscape of Post-Quantum Cryptography.pptx
FIDO Alliance
 
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Creating Inclusive Digital Learning with AI: A Smarter, Fairer Future
Impelsys Inc.
 
MuleSoft for AgentForce : Topic Center and API Catalog
MuleSoft for AgentForce : Topic Center and API Catalog
shyamraj55
 
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
ReSTIR [DI]: Spatiotemporal reservoir resampling for real-time ray tracing ...
revolcs10
 
Crypto Super 500 - 14th Report - June2025.pdf
Crypto Super 500 - 14th Report - June2025.pdf
Stephen Perrenod
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
AI VIDEO MAGAZINE - June 2025 - r/aivideo
AI VIDEO MAGAZINE - June 2025 - r/aivideo
1pcity Studios, Inc
 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 

Hello world - intro to node js