SlideShare una empresa de Scribd logo
1 de 46
NODEJS WEB DEVELOPMENT
By Irfan Maulana | SDE at Blibli.com
About me
• Name : Irfan Maulana
• Work : PT. Global Digital Niaga (Blibli.com)
• Role : Software Development Engineer
• Full-stack developer in Java and Javascript
Outline
1. Intro
2. Getting Know NodeJS
3. Power of NodeJS
4. Web Development with NodeJS
5. Demo
6. Bundling Assets in NodeJS (*depend with time)
7. Unit Test (*depend with time)
1. INTRO
Are you Javascript developer ?
JS Popularity
Source : stackoverflow
Before Node
After Node
2. GETTING KNOW NODEJS
Nodejs Wiki
• JavaScript runtime built on Chrome's V8 JavaScript
engine.
Native JS v Nodejs
Nodejs live in different side with native js
FRONT-SIDE BACK-SIDE
Man Behind
• Originally written in 2009 by Ryan Dahl
(github.com/ry) and demonstrate in European
JSConf November 8 2009
• Inspired by file upload progress bar on flickr
3. POWER OF NODEJS
Isomorphic Javascript
• Isomorphic from the greek “isos” for equal and
“morph” for shape
• When backend and frontend share the same code
Non-Blocking I/O
• Not like a traditional thread base I/O, nodejs using
single thread as a native Javascript has do
• In thread base, you must allocate maximal thread in
your webserver and every thread will execute one
task in one moment, if there another request will be
execute after first request has done
• Nodejs’s thread can execute other request without
waiting, it will return callbacks that will be only filled
when request has done.
• Callback that provide is not always the Data, it can
be an exception
Async Request Handler
Source : strongloop
NPM
• Include when you install node
• You can install and manage all your dependency
easier
Third-Party Library
• Have a goodness of JavaScript, easy to extends, easy
to rebuild your own library
• In npmjs.com 253167 total packages library
• Will be many choices for each library, just choose as
you need
4. WEB DEVELOPMENT WITH NODEJS
Development Stack
• Framework : Expressjs
• Database : Mongodb (using mongoose module for
connection)
• Template Engine : Jade
Expressjs
• Express is a minimal and flexible Node.js web
application framework that provides a robust set of
features for web and mobile applications.
(http://expressjs.com/ )
Expressjs Install
• Installing : npm install express
• Initial project : express init sampleapp
• Install dependency : npm install (in project directory)
• Run project : npm start
Expressjs Basic Routing
This route will redirect to index.jade and set data title
that will be process in server side by jade
This route will send you json response
Mongoose
• elegant mongodb object modeling for node.js
(http://mongoosejs.com/)
• Installing : just add dependency in package.json and
run npm install
MongoDB Connection
Just require mongoose depedency and connect with
mongoodb in one line code.
Schema and Model
Schema is our mongoDB collection (table) structure
wrapper.
Model is object that we use for querying.
Using Model for Query
• We using product model for find (*select all) data
• This route will return json of all data in table Product
• Access in URL / with method GET
Jade - Template Engine
• Lightweight templating engine
• Adopt JSON structure instead XML
• http://jade-lang.com/
Jade v HTML
In jade, you never worry about close tag that spent
your time.
Just indent like you see HTML
Jade for snippet
We create
layout.jade as
our main
layout, we
define block
css, content
and javascript
that will use
later
Using snippet
• Here we use
our
layout.jade
and fill our
block content,
javascript we
defined
• We can split
our big page,
into smaller
block than just
include that
file
Server Renderer
5. DEMO
Fork on : https://github.com/mazipan/nodejs-simple-restfull-
with-express
6. BUNDLING ASSETS IN NODEJS
Grunt
• The Javascript Task Runner (http://gruntjs.com/)
• Why ?
• In one word: automation. The less work you have to
do when performing repetitive tasks like minification,
compilation, unit testing, linting, etc, the easier your
job becomes.
• Install CLI : npm install -g grunt-cli
• Added grunt and grunt plugin in devDepedencies
Configure Task
• Create Gruntfile.js
• Initial configure your task
• Load your task
• Register your task
Uglify
• Javascript assets minifying and bundling into one file if
needed
CSS Minify
• CSS assets minifying and concating
7. UNIT TEST
Our Module for Test
• Supertest is our agent that will access url method like
postman
• Should is easy understand assertion
• Mocha is our main test case
• Install mocha before : npm install –g mocha
• Run : mocha test or node test (in project directory)
Setup depedency
• Setup devDependency in package.json
• You can setup script test execution for using node test
Sample Unit Test
GITHUB REPO & CONTACT ME
Github Repository
• https://github.com/mazipan/nodejs-simple-restfull-
with-express
• https://github.com/mazipan/nodejs-simple-restfull-
test-with-mocha
• https://github.com/mazipan/nodejs-mongodb-simple-
library-application
Contact me
mazipanneh.wordpress.com
@Maz_Ipan
/mazipanneh
/in/irfanmaulanamazipan
mazipanneh@gmail.com
PHP Indonesia - Nodejs Web Development

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
JavaScript as a Server side language (NodeJS): JSConf 2011, DhakaJavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
JavaScript as a Server side language (NodeJS): JSConf 2011, Dhaka
 
Introduction to CQ5
Introduction to CQ5Introduction to CQ5
Introduction to CQ5
 
Introduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azureIntroduction to node js - From "hello world" to deploying on azure
Introduction to node js - From "hello world" to deploying on azure
 
Node js projects
Node js projectsNode js projects
Node js projects
 
Understand How Node.js and Core Features Works
Understand How Node.js and Core Features WorksUnderstand How Node.js and Core Features Works
Understand How Node.js and Core Features Works
 
Node js
Node jsNode js
Node js
 
Don't worry with bower
Don't worry with bowerDon't worry with bower
Don't worry with bower
 
CQ5 Development Setup, Maven Build and Deployment
CQ5 Development Setup, Maven Build and DeploymentCQ5 Development Setup, Maven Build and Deployment
CQ5 Development Setup, Maven Build and Deployment
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jiban
 
Nodeconf npm 2011
Nodeconf npm 2011Nodeconf npm 2011
Nodeconf npm 2011
 
Introduction to REST API with Node.js
Introduction to REST API with Node.jsIntroduction to REST API with Node.js
Introduction to REST API with Node.js
 
A slightly advanced introduction to node.js
A slightly advanced introduction to node.jsA slightly advanced introduction to node.js
A slightly advanced introduction to node.js
 
Introduction to node.js
Introduction to node.jsIntroduction to node.js
Introduction to node.js
 
Adobe CQ5 for Developers - Introduction
Adobe CQ5 for Developers - IntroductionAdobe CQ5 for Developers - Introduction
Adobe CQ5 for Developers - Introduction
 
Introduction to node.js aka NodeJS
Introduction to node.js aka NodeJSIntroduction to node.js aka NodeJS
Introduction to node.js aka NodeJS
 
Nodejs getting started
Nodejs getting startedNodejs getting started
Nodejs getting started
 
Node, express & sails
Node, express & sailsNode, express & sails
Node, express & sails
 
Conquering AngularJS Limitations
Conquering AngularJS LimitationsConquering AngularJS Limitations
Conquering AngularJS Limitations
 
Let's server your Data
Let's server your DataLet's server your Data
Let's server your Data
 
Node js training (1)
Node js training (1)Node js training (1)
Node js training (1)
 

Destacado

Destacado (20)

Php Indonesia x Bliblidotcom - Architecting Scalable CSS
Php Indonesia x Bliblidotcom - Architecting Scalable CSSPhp Indonesia x Bliblidotcom - Architecting Scalable CSS
Php Indonesia x Bliblidotcom - Architecting Scalable CSS
 
JakartaJS - How I Learn Javascript From Basic
JakartaJS - How I Learn Javascript From BasicJakartaJS - How I Learn Javascript From Basic
JakartaJS - How I Learn Javascript From Basic
 
Php regional bogor
Php regional bogorPhp regional bogor
Php regional bogor
 
Bliblidotcom - Reintroduction BEM CSS
Bliblidotcom - Reintroduction BEM CSSBliblidotcom - Reintroduction BEM CSS
Bliblidotcom - Reintroduction BEM CSS
 
Web Development with Node.js
Web Development with Node.jsWeb Development with Node.js
Web Development with Node.js
 
NodeMN: Building AI into your Node.js apps
NodeMN: Building AI into your Node.js appsNodeMN: Building AI into your Node.js apps
NodeMN: Building AI into your Node.js apps
 
Email Marketing by Payment Wallet Industry
Email Marketing by Payment Wallet IndustryEmail Marketing by Payment Wallet Industry
Email Marketing by Payment Wallet Industry
 
ARIM Technologies Brochure - Managed Security Services
ARIM Technologies Brochure - Managed Security ServicesARIM Technologies Brochure - Managed Security Services
ARIM Technologies Brochure - Managed Security Services
 
Award winning Email Marketing Case Study (2016 EEC Email Marketing Program Aw...
Award winning Email Marketing Case Study (2016 EEC Email Marketing Program Aw...Award winning Email Marketing Case Study (2016 EEC Email Marketing Program Aw...
Award winning Email Marketing Case Study (2016 EEC Email Marketing Program Aw...
 
Email Marketing Case Study: Innovative Anniversary email marketig campaign by...
Email Marketing Case Study: Innovative Anniversary email marketig campaign by...Email Marketing Case Study: Innovative Anniversary email marketig campaign by...
Email Marketing Case Study: Innovative Anniversary email marketig campaign by...
 
Indonesia Email Marketing Trends 2016
Indonesia Email Marketing Trends 2016Indonesia Email Marketing Trends 2016
Indonesia Email Marketing Trends 2016
 
Nodejs in Production
Nodejs in ProductionNodejs in Production
Nodejs in Production
 
Building Web Apps & APIs With Node JS
Building Web Apps & APIs With Node JSBuilding Web Apps & APIs With Node JS
Building Web Apps & APIs With Node JS
 
Irfan Maulana - Career Journey
Irfan Maulana - Career JourneyIrfan Maulana - Career Journey
Irfan Maulana - Career Journey
 
NodeJS security - still unsafe at most speeds - v1.0
NodeJS security - still unsafe at most speeds - v1.0NodeJS security - still unsafe at most speeds - v1.0
NodeJS security - still unsafe at most speeds - v1.0
 
Email Marketing for ECommerce: Creating personalized experiences
Email Marketing for ECommerce: Creating personalized experiencesEmail Marketing for ECommerce: Creating personalized experiences
Email Marketing for ECommerce: Creating personalized experiences
 
Node Architecture Implications for In-Memory Data Analytics on Scale-in Clusters
Node Architecture Implications for In-Memory Data Analytics on Scale-in ClustersNode Architecture Implications for In-Memory Data Analytics on Scale-in Clusters
Node Architecture Implications for In-Memory Data Analytics on Scale-in Clusters
 
Testing NodeJS Security
Testing NodeJS SecurityTesting NodeJS Security
Testing NodeJS Security
 
Blibli.com[kiyosaki]
Blibli.com[kiyosaki]Blibli.com[kiyosaki]
Blibli.com[kiyosaki]
 
Marketing Automation Case Study
Marketing Automation Case StudyMarketing Automation Case Study
Marketing Automation Case Study
 

Similar a PHP Indonesia - Nodejs Web Development

Similar a PHP Indonesia - Nodejs Web Development (20)

NodeJS - Server Side JS
NodeJS - Server Side JS NodeJS - Server Side JS
NodeJS - Server Side JS
 
Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]Java script nirvana in netbeans [con5679]
Java script nirvana in netbeans [con5679]
 
An introduction to Node.js
An introduction to Node.jsAn introduction to Node.js
An introduction to Node.js
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)
 
Mongo and node mongo dc 2011
Mongo and node mongo dc 2011Mongo and node mongo dc 2011
Mongo and node mongo dc 2011
 
A Journey Begin with Node.js
A Journey Begin with Node.jsA Journey Begin with Node.js
A Journey Begin with Node.js
 
Meanstack overview
Meanstack overviewMeanstack overview
Meanstack overview
 
An Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows AzureAn Introduction to Node.js Development with Windows Azure
An Introduction to Node.js Development with Windows Azure
 
Node js crash course session 1
Node js crash course   session 1Node js crash course   session 1
Node js crash course session 1
 
Introduction to Napa.js
Introduction to Napa.jsIntroduction to Napa.js
Introduction to Napa.js
 
NodeJS Presentation
NodeJS PresentationNodeJS Presentation
NodeJS Presentation
 
The MEAN Stack
The MEAN StackThe MEAN Stack
The MEAN Stack
 
Mini-Training: Node.js
Mini-Training: Node.jsMini-Training: Node.js
Mini-Training: Node.js
 
Node js installation steps.pptx slide share ppts
Node js installation steps.pptx slide share pptsNode js installation steps.pptx slide share ppts
Node js installation steps.pptx slide share ppts
 
Node.js Development with Apache NetBeans
Node.js Development with Apache NetBeansNode.js Development with Apache NetBeans
Node.js Development with Apache NetBeans
 
Advanced Web Technology.pptx
Advanced Web Technology.pptxAdvanced Web Technology.pptx
Advanced Web Technology.pptx
 
node_js.pptx
node_js.pptxnode_js.pptx
node_js.pptx
 
What is Mean Stack Development ?
What is Mean Stack Development ?What is Mean Stack Development ?
What is Mean Stack Development ?
 
Overview of Node JS
Overview of Node JSOverview of Node JS
Overview of Node JS
 
NWJS. Web on desktop
NWJS. Web on desktopNWJS. Web on desktop
NWJS. Web on desktop
 

Más de Irfan Maulana

Más de Irfan Maulana (17)

Modern Web - an Introduction
Modern Web - an IntroductionModern Web - an Introduction
Modern Web - an Introduction
 
Unit Testing for Frontend Code at Blibli.com
Unit Testing for Frontend Code at Blibli.comUnit Testing for Frontend Code at Blibli.com
Unit Testing for Frontend Code at Blibli.com
 
Programmer In Startup Era
Programmer In Startup EraProgrammer In Startup Era
Programmer In Startup Era
 
Bliblidotcom - Evolusi Frontend Development di Bliblidotcom
Bliblidotcom - Evolusi Frontend Development di BliblidotcomBliblidotcom - Evolusi Frontend Development di Bliblidotcom
Bliblidotcom - Evolusi Frontend Development di Bliblidotcom
 
Bliblidotcom - Tech In Asia PDC 2017 Takeaway
Bliblidotcom - Tech In Asia PDC 2017 TakeawayBliblidotcom - Tech In Asia PDC 2017 Takeaway
Bliblidotcom - Tech In Asia PDC 2017 Takeaway
 
Bliblidotcom - AMP And PWA
Bliblidotcom - AMP And PWABliblidotcom - AMP And PWA
Bliblidotcom - AMP And PWA
 
Angular - The Return of The King
Angular - The Return of The KingAngular - The Return of The King
Angular - The Return of The King
 
How to Become Rockstar Programmer
How to Become Rockstar ProgrammerHow to Become Rockstar Programmer
How to Become Rockstar Programmer
 
Bliblidotcom - AngularJS Introduction
Bliblidotcom - AngularJS IntroductionBliblidotcom - AngularJS Introduction
Bliblidotcom - AngularJS Introduction
 
Journey To The Front End World - Part3 - The Machine
Journey To The Front End World - Part3 - The MachineJourney To The Front End World - Part3 - The Machine
Journey To The Front End World - Part3 - The Machine
 
Bliblidotcom - SASS Introduction
Bliblidotcom - SASS IntroductionBliblidotcom - SASS Introduction
Bliblidotcom - SASS Introduction
 
Journey To The Front End World - Part2 - The Cosmetic
Journey To The Front End World - Part2 - The  CosmeticJourney To The Front End World - Part2 - The  Cosmetic
Journey To The Front End World - Part2 - The Cosmetic
 
Journey To The Front End World - Part1 - The Skeleton
Journey To The Front End World - Part1 - The SkeletonJourney To The Front End World - Part1 - The Skeleton
Journey To The Front End World - Part1 - The Skeleton
 
PHP Indonesia - Understanding UI UX from Developer Side
PHP Indonesia - Understanding UI UX from Developer SidePHP Indonesia - Understanding UI UX from Developer Side
PHP Indonesia - Understanding UI UX from Developer Side
 
Create Rest API in Nodejs
Create Rest API in Nodejs Create Rest API in Nodejs
Create Rest API in Nodejs
 
Sencha ExtJs Learning Part 2 - MVC And MVVM Architecture in ExtJs [ENGLISH]
Sencha ExtJs Learning Part 2 - MVC And MVVM Architecture in ExtJs [ENGLISH]Sencha ExtJs Learning Part 2 - MVC And MVVM Architecture in ExtJs [ENGLISH]
Sencha ExtJs Learning Part 2 - MVC And MVVM Architecture in ExtJs [ENGLISH]
 
Sencha ExtJs Learning Part 1 - Layout And Container in Sencha ExtJs - By Irfa...
Sencha ExtJs Learning Part 1 - Layout And Container in Sencha ExtJs - By Irfa...Sencha ExtJs Learning Part 1 - Layout And Container in Sencha ExtJs - By Irfa...
Sencha ExtJs Learning Part 1 - Layout And Container in Sencha ExtJs - By Irfa...
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 

PHP Indonesia - Nodejs Web Development