SlideShare a Scribd company logo
Welcome!
Node.js Getting Started
<@Triet Ho/>
Objectives
• After this seminar, the audiences are able to :
• Understand the basic of Node.js and common modules
• Create simple Node.js app
• Start to learn deeper
Agenda – 1 hours
• What is Node.js and how it works
• Node.js Installation
• Node.js project and module structure
• Common packages
• Host a nodejs app with PM2
What is Node.js
• Compare of JS in browser and Node.js (node apps)
Chrome Browser
V8 JS
Engine
HTML + CSS + JS
…
Node.js
Async I/O
libuv
JS
V8 JS
Engine
Event Loop
libuv
Node Bindings
(socket, http, file system,…)
Node Standard Library
chrome.exe node.exe
What is Node.js
Hello World!
• File: demo.js
• Run demo.js
What is Node.js
Async I/O and Event Loop
• Node.js uses an event-driven, non-blocking I/O
model
• Aka: Callbacks
• FileSystem Api as examples:
https://nodejs.org/api/fs.html
Installation
• Just download and install (included npm tool)
• https://nodejs.org/en/download/
• Or via package-manager for linux family:
• https://nodejs.org/en/download/package-manager/
• npm: Node Package Manager
• Find, share, and reuse packages of code from hundreds of thousands of developers
• Npm install <package name> [-g ]
• -g: install to global that every node apps can use
Project Structure
• Basic structure:
• Generate package.json
npm init
• Advanced structure (use node express for web app):
• Express.js (node express): Fast, unopinionated, minimalist
web framework for Node.js
• http://expressjs.com/en/starter/generator.html
Project Structure
package.json
• Define app metadata and the starting point
• npm start in root app folder will exec node bin/www
• npm install in root app will download and install the
packages in dependences section
• The packages are stored in node_modules folder
Module
• Organize code better
• The common pattern:
• The list of module patterns:
• https://darrenderidder.github.io/talks/ModulePatterns/#/
Common packages
• Framework for creating web apps
• Express.js: it has a generator to create project, http://expressjs.com/
• Template Engines (Rendering UI for node web apps)
• EJS https://www.npmjs.com/package/ejs
• Pug (jade) https://pugjs.org/api/getting-started.html
• Mustache: https://github.com/janl/mustache.js
• Working with asynchronous JS
• Assync.js: https://github.com/caolan/async
• Promise (bluebird), http://bluebirdjs.com/docs/getting-started.html
• Working with database
• Mongoose: http://mongoosejs.com/,
• mysql: https://github.com/mysqljs/mysql
• SQL Server: https://www.npmjs.com/package/mssql
Host a node app with PM2
• PM2 - production process manager for Node.js applications
• with a built-in load balancer
• keep applications alive forever
• reload them without downtime
• and to facilitate common system admin tasks
• Install PM2
• pm2 start <startpoint.js>
• Ref: https://github.com/Unitech/pm2
Others
• IDE: any text editor, Visual Studio Code, notepad++, net beans…
• ES6: ECMAScript 6 (aka ECMAScript 2015)
• New features of JavaScript language (and including previous version - ES5)
• Tutorial: http://ccoenraets.github.io/es6-tutorial/ (new syntax, let, lamda, class, module,
promise...)
• Unit Test:
• get start: https://www.codementor.io/nodejs/tutorial/unit-testing-nodejs-tdd-mocha-
sinon
• CI: ???
• Flow control:
• http://blog.vullum.io/javascript-flow-callback-hell-vs-async-vs-highland/
Questions?
Cafe!

More Related Content

What's hot (20)

PDF
Best node js course
bestonlinecoursescoupon
 
PDF
Complete MVC on NodeJS
HĂźseyin BABAL
 
PPTX
Introduction to Node.js
Vikash Singh
 
PDF
Introduction to node js - From "hello world" to deploying on azure
Colin Mackay
 
PPTX
Node js training (1)
Ashish Gupta
 
PDF
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
Nurul Ferdous
 
PPTX
Introduction to node.js GDD
Sudar Muthu
 
KEY
OSCON 2011 - Node.js Tutorial
Tom Croucher
 
PDF
Use Node.js to create a REST API
Fabien Vauchelles
 
PPT
RESTful API In Node Js using Express
Jeetendra singh
 
PPTX
Java script at backend nodejs
Amit Thakkar
 
PPTX
Introduction to node.js
Arun Kumar Arjunan
 
PDF
NodeJS ecosystem
Yukti Kaura
 
PDF
Node.js Explained
Jeff Kunkle
 
PPT
Introduction to node.js aka NodeJS
JITENDRA KUMAR PATEL
 
PDF
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Edureka!
 
PPTX
Introduction to node.js by jiban
Jibanananda Sana
 
PDF
Introduction to Node.js
Rob O'Doherty
 
PPT
Node js
Chirag Parmar
 
PPTX
Node js for enterprise
ravisankar munusamy
 
Best node js course
bestonlinecoursescoupon
 
Complete MVC on NodeJS
HĂźseyin BABAL
 
Introduction to Node.js
Vikash Singh
 
Introduction to node js - From "hello world" to deploying on azure
Colin Mackay
 
Node js training (1)
Ashish Gupta
 
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
Nurul Ferdous
 
Introduction to node.js GDD
Sudar Muthu
 
OSCON 2011 - Node.js Tutorial
Tom Croucher
 
Use Node.js to create a REST API
Fabien Vauchelles
 
RESTful API In Node Js using Express
Jeetendra singh
 
Java script at backend nodejs
Amit Thakkar
 
Introduction to node.js
Arun Kumar Arjunan
 
NodeJS ecosystem
Yukti Kaura
 
Node.js Explained
Jeff Kunkle
 
Introduction to node.js aka NodeJS
JITENDRA KUMAR PATEL
 
Node.js Tutorial for Beginners | Node.js Web Application Tutorial | Node.js T...
Edureka!
 
Introduction to node.js by jiban
Jibanananda Sana
 
Introduction to Node.js
Rob O'Doherty
 
Node js
Chirag Parmar
 
Node js for enterprise
ravisankar munusamy
 

Similar to Nodejs getting started (20)

PPTX
Node js Powerpoint Presentation by PDEU Gandhinagar
tirthuce22
 
PPTX
Node js meetup
Ansuman Roy
 
PPTX
Intro to Node.js (v1)
Chris Cowan
 
DOCX
unit 2 of Full stack web development subject
JeneferAlan1
 
PPTX
Node.js Chapter1
Talentica Software
 
PDF
🚀 Node.js Simplified – A Visual Guide for Beginners!
Tpoint Tech Blog
 
PPTX
Basic Concept of Node.js & NPM
Bhargav Anadkat
 
PDF
Nodejs vatsal shah
Vatsal N Shah
 
PPTX
An overview of node.js
valuebound
 
PDF
Nodejs presentation
Arvind Devaraj
 
PPTX
node.js.pptx
rani marri
 
PDF
Introduction to Node.js
Aaron Rosenberg
 
PPTX
Kalp Corporate Node JS Perfect Guide
Kalp Corporate
 
PDF
Node.js for beginner
Sarunyhot Suwannachoti
 
PPTX
Introduction to node.js By Ahmed Assaf
Ahmed Assaf
 
PDF
Node.js Web Development .pdf
Abanti Aazmin
 
PDF
Introduction to Node.js
Jack Franklin
 
PPTX
JS & NodeJS - An Introduction
Nirvanic Labs
 
Node js Powerpoint Presentation by PDEU Gandhinagar
tirthuce22
 
Node js meetup
Ansuman Roy
 
Intro to Node.js (v1)
Chris Cowan
 
unit 2 of Full stack web development subject
JeneferAlan1
 
Node.js Chapter1
Talentica Software
 
🚀 Node.js Simplified – A Visual Guide for Beginners!
Tpoint Tech Blog
 
Basic Concept of Node.js & NPM
Bhargav Anadkat
 
Nodejs vatsal shah
Vatsal N Shah
 
An overview of node.js
valuebound
 
Nodejs presentation
Arvind Devaraj
 
node.js.pptx
rani marri
 
Introduction to Node.js
Aaron Rosenberg
 
Kalp Corporate Node JS Perfect Guide
Kalp Corporate
 
Node.js for beginner
Sarunyhot Suwannachoti
 
Introduction to node.js By Ahmed Assaf
Ahmed Assaf
 
Node.js Web Development .pdf
Abanti Aazmin
 
Introduction to Node.js
Jack Franklin
 
JS & NodeJS - An Introduction
Nirvanic Labs
 
Ad

Recently uploaded (20)

PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PDF
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
PDF
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
SIZING YOUR AIR CONDITIONER---A PRACTICAL GUIDE.pdf
Muhammad Rizwan Akram
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Kit-Works Team Study_20250627_한달만에만든사내서비스키링(양다윗).pdf
Wonjun Hwang
 
Transcript: Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
Peak of Data & AI Encore AI-Enhanced Workflows for the Real World
Safe Software
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
AI Agents in the Cloud: The Rise of Agentic Cloud Architecture
Lilly Gracia
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Ad

Nodejs getting started

  • 2. Objectives • After this seminar, the audiences are able to : • Understand the basic of Node.js and common modules • Create simple Node.js app • Start to learn deeper
  • 3. Agenda – 1 hours • What is Node.js and how it works • Node.js Installation • Node.js project and module structure • Common packages • Host a nodejs app with PM2
  • 4. What is Node.js • Compare of JS in browser and Node.js (node apps) Chrome Browser V8 JS Engine HTML + CSS + JS … Node.js Async I/O libuv JS V8 JS Engine Event Loop libuv Node Bindings (socket, http, file system,…) Node Standard Library chrome.exe node.exe
  • 5. What is Node.js Hello World! • File: demo.js • Run demo.js
  • 6. What is Node.js Async I/O and Event Loop • Node.js uses an event-driven, non-blocking I/O model • Aka: Callbacks • FileSystem Api as examples: https://nodejs.org/api/fs.html
  • 7. Installation • Just download and install (included npm tool) • https://nodejs.org/en/download/ • Or via package-manager for linux family: • https://nodejs.org/en/download/package-manager/ • npm: Node Package Manager • Find, share, and reuse packages of code from hundreds of thousands of developers • Npm install <package name> [-g ] • -g: install to global that every node apps can use
  • 8. Project Structure • Basic structure: • Generate package.json npm init • Advanced structure (use node express for web app): • Express.js (node express): Fast, unopinionated, minimalist web framework for Node.js • http://expressjs.com/en/starter/generator.html
  • 9. Project Structure package.json • Define app metadata and the starting point • npm start in root app folder will exec node bin/www • npm install in root app will download and install the packages in dependences section • The packages are stored in node_modules folder
  • 10. Module • Organize code better • The common pattern: • The list of module patterns: • https://darrenderidder.github.io/talks/ModulePatterns/#/
  • 11. Common packages • Framework for creating web apps • Express.js: it has a generator to create project, http://expressjs.com/ • Template Engines (Rendering UI for node web apps) • EJS https://www.npmjs.com/package/ejs • Pug (jade) https://pugjs.org/api/getting-started.html • Mustache: https://github.com/janl/mustache.js • Working with asynchronous JS • Assync.js: https://github.com/caolan/async • Promise (bluebird), http://bluebirdjs.com/docs/getting-started.html • Working with database • Mongoose: http://mongoosejs.com/, • mysql: https://github.com/mysqljs/mysql • SQL Server: https://www.npmjs.com/package/mssql
  • 12. Host a node app with PM2 • PM2 - production process manager for Node.js applications • with a built-in load balancer • keep applications alive forever • reload them without downtime • and to facilitate common system admin tasks • Install PM2 • pm2 start <startpoint.js> • Ref: https://github.com/Unitech/pm2
  • 13. Others • IDE: any text editor, Visual Studio Code, notepad++, net beans… • ES6: ECMAScript 6 (aka ECMAScript 2015) • New features of JavaScript language (and including previous version - ES5) • Tutorial: http://ccoenraets.github.io/es6-tutorial/ (new syntax, let, lamda, class, module, promise...) • Unit Test: • get start: https://www.codementor.io/nodejs/tutorial/unit-testing-nodejs-tdd-mocha- sinon • CI: ??? • Flow control: • http://blog.vullum.io/javascript-flow-callback-hell-vs-async-vs-highland/
  • 15. Cafe!