SlideShare ist ein Scribd-Unternehmen logo
1 von 50
JACOB NELSON
SOFTWARE ARCHITECT
Node.js is not a silver-bullet new platform that will
dominate the web development world. Instead,
it’s a platform that fills a particular need.
A word of warning
There are some really excellent JavaScript people out
there. I'm not one of them.
Node JS is a powerful tool for controlling web
servers, building applications, and creating event-
driven programming and it brings JavaScript, a
language familiar to all web developers, into an
environment independent of web browsers.
Node.js® is a JavaScript runtime built
on Chrome'sV8 JavaScript engine.
Runtime is when a program is
running (or being executable).That is,
when you start a program running in
a computer, it is runtime for that
program.
Node.js is not a JavaScript framework
Node.js allows you to run JavaScript
code in the backend, outside a
browser.
+
Node.js ships with a lot of useful
modules, so you don't have to write
everything from scratch
Thus, Node.js is really two things:
a runtime environment and a library.
Requirements
▪ JavaScript
▪ Command-LineTool
V8
TheV8 JavaScript Engine is an open source JavaScript
engine developed byThe Chromium Project for the
Google Chrome web browser. It has seen used in
many other projects, such as Couchbase, MongoDB
and Node.js.
https://en.wikipedia.org/wiki/V8_(JavaScript_engine)
Threading
Node is single-threaded and uses a concurrency
model based on an event loop. It is non-blocking, so it
doesn't make the program wait, but instead it
registers a callback and lets the program continue.
This means it can handle concurrent operations
without multiple threads of execution, so it can scale
pretty well.
Installing Node
If you're using OS X orWindows, the best way to
install Node.js is to use one of the installers from the
Node.js download page.
If you're using Linux, you can use the installer, or you
can check Node Source's binary distributions to see
whether or not there's a more recent version that
works with your system.
Test
node -v
npm, the official Node package manager
npm is the package manager for JavaScript.
npm makes it easy for JavaScript developers to share
and reuse code, and it makes it easy to update the
code that you're sharing.
npm, the official Node package manager
Node comes with npm installed so you should have a
version of npm. However, npm gets updated more
frequently than Node does, so you'll want to make
sure it's the latest version.
npm, the official Node package manager
▪ It installs application dependencies locally, not globally.
▪ It handles multiple versions of the same module at the
same time.
▪ You can specify tarballs or git repositories as
dependencies.
▪ It's really easy to publish your own module to the npm
registry.
▪ It's useful for creating CLI utilities that others can install
(with npm) and use right away.
Npm behind firewall
npm config set proxy http://gateway.zscaler.net:9400
npm config set https-proxy
http://gateway.zscaler.net:9400
Updating npm
npm install npm@latest -g
Test
npm -v
Your First Program
console.log('HelloWorld');
npm init
The npm init command is a step-by-step tool to scaffold
out your project. It will prompt you for input for a few
aspects of the project in the following order:
npm init
▪ The project's name
▪ The project's initial version
▪ The project's description
▪ The project's entry point (meaning the project's main file)
▪ The project's test command (to trigger testing with something like Standard)
▪ The project's git repository (where the project source can be found)
▪ The project's keywords (basically, tags related to the project)
▪ The project's license (this defaults to ISC - most open-source Node.js projects are
MIT)
npm init
Once you run through the npm init steps above, a
package.json file will be generated and placed in the
current directory. If you run it in a directory that's not
exclusively for your project, don't worry! Generating a
package.json doesn't really do anything, other than create
a package.json file.You can either move the package.json
file to a directory that's dedicated to your project, or you
can create an entirely new one in such a directory.
npm init
Once you run through the npm init steps above, a
package.json file will be generated and placed in the
current directory. If you run it in a directory that's not
exclusively for your project, don't worry! Generating a
package.json doesn't really do anything, other than create
a package.json file.You can either move the package.json
file to a directory that's dedicated to your project, or you
can create an entirely new one in such a directory.
npm init options
If you invoke it with -f, --force, -y, or --yes, it will use only
defaults and not prompt you for any options.
package.json
package.json file can be described as a manifest of your
project that includes the packages and applications it
depends on, information about its unique source control,
and specific metadata like the project's name, description,
and author.
package.json
package.json
package.json also contains a collection of any given project's
dependencies.These dependencies are the modules that the project
relies on to function properly.
package.json - dependencies
Dependencies are specified in a simple object that maps a package
name to a version range.The version range is a string which has one or
more space-separated descriptors.
Having dependencies in your project's package.json allows the project
to install the versions of the modules it depends on. By running an
install command inside of a project, you can install all of the
dependencies that are listed in the project's package.json - meaning
they don't have to be (and almost never should be) bundled with the
project itself.
package.json - devDependencies
It also allows the separation of dependencies that are needed for
production and dependencies that are needed for development. In
production, you're likely not going to need a tool to watch yourCSS
files for changes and refresh the app when they change.
package.json – module version
▪ version Must match version exactly
▪ >version Must be greater than version
▪ >=version etc
▪ <version
▪ <=version~version "Approximately equivalent to version"
▪ ^version "Compatible with version"
▪ 1.2.x 1.2.0, 1.2.1, etc., but not 1.3.0
package.json – module version
▪ http://...
▪ * Matches any version
▪ "" (just an empty string) Same as *
▪ version1 - version2 Same as >=version1 <=version2.
▪ range1 || range2 Passes if either range1 or range2 are satisfied.
▪ git...
▪ user/repo See 'GitHub URLs' below
▪ tagA specific version tagged and published as tag
▪ path/path/path
Modules - Installation
npm install <-g> module name
Modules – Installation
npm install
Once you run this, npm will begin the installation process of all of the
current project's dependencies.
Modules – Installation Options
npm install <module> --save
when installing a module: --save, it will install and save it as an entry in
the dependencies
npm install <module> --save-dev
when installing a module: --save-dev, it will install and save it as an
entry in the devDependencies
Modules – Listing
Sometimes is useful to see the list of packages that you have installed
on your system.You can do that with the following commands:
# list all installed modules with dependencies
npm ls
# list all installed modules without dependencies
npm ls --depth=0
# list all installed globally dependencies
npm ls -g --depth=0
Extraneous Modules
Modules which are installed and are found on node_modules folder, but
not included as Dependency or devDependency in package.json
Module – uninstallation
# uninstall package and leave it listed as dep
npm uninstall <package_name>
# uninstall and remove from dependencies
npm uninstall --save <package_name>
# uninstall global package
npm uninstall -g <package_name>
# remove uninstalled packages from node_modules
npm prune
Modules – view all versions of an NPM
Package
The easy way to view all released versions of an npm package is to use
the following command
npm show <module>@* version
Modules - Importing
▪ Java or Python use the import function to load other libraries,
▪ PHP and Ruby use require.
▪ In Node you can load other dependencies using the require keyword.
Modules - Importing
▪ For example, we can require some core modules:
▪ var http = require('http');
▪ var dns = require('dns');
Modules - Importing
What node.js will do in this case, is to first look if there is a core module
named http, and since that's the case, return that directly. But what
about non-core modules, such as 'mysql'?
In this case node.js will walk up the directory tree, moving through each
parent directory in turn, checking in each to see if there is a folder
called 'node_modules'. If such a folder is found, node.js will look into
this folder for a file called 'mysql.js'. If no matching file is found and the
directory root '/' is reached, node.js will give up and throw an exception.
Modules - Importing
▪ We can also require relative files:
▪ var myFile = require('./myFile'); // loads myFile.js
callbacks
In asynchronous programming we do not return values when our
functions are done, but instead we use the continuation-passing style
(CPS).
With this style, an asynchronous function invokes a callback (a function
usually passed as the last argument) to continue the program once the
it has finished.
When Not to Use?
▪ CPU heavy apps
▪ Simple CRUD / HTML apps
▪ NoSQL + Node.js
When to Use?
▪ JSON APIs
▪ Single page apps
▪ Streaming Data
▪ Soft Real time Applications
▪ https://www.guru99.com/node-js-tutorial.html
▪ http://www.tutorialsteacher.com/nodejs/nodejs-basics
▪ https://www.javatpoint.com/what-is-nodejs
▪ http://adrianmejia.com/blog/2016/08/19/Node-Package-Manager-NPM-
Tutorial/
▪ https://nodesource.com/blog/an-absolute-beginners-guide-to-using-npm/
▪ Best Practices
▪ https://www.codementor.io/mattgoldspink/nodejs-best-practices-
du1086jja

Weitere ähnliche Inhalte

Was ist angesagt?

Java script at backend nodejs
Java script at backend   nodejsJava script at backend   nodejs
Java script at backend nodejsAmit Thakkar
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsMarcus Frödin
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node jsAkshay Mathur
 
Node Architecture and Getting Started with Express
Node Architecture and Getting Started with ExpressNode Architecture and Getting Started with Express
Node Architecture and Getting Started with Expressjguerrero999
 
Building servers with Node.js
Building servers with Node.jsBuilding servers with Node.js
Building servers with Node.jsConFoo
 
Communication in Node.js
Communication in Node.jsCommunication in Node.js
Communication in Node.jsEdureka!
 
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialOSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialTom Croucher
 
Introduction to Node.JS Express
Introduction to Node.JS ExpressIntroduction to Node.JS Express
Introduction to Node.JS ExpressEueung Mulyana
 
An Introduction To Testing In AngularJS Applications
An Introduction To Testing In AngularJS Applications An Introduction To Testing In AngularJS Applications
An Introduction To Testing In AngularJS Applications Rohan Chandane
 
Nodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web ApplicationsNodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web ApplicationsGanesh Iyer
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with ExamplesGabriele Lana
 
Node.js Explained
Node.js ExplainedNode.js Explained
Node.js ExplainedJeff Kunkle
 

Was ist angesagt? (20)

Java script at backend nodejs
Java script at backend   nodejsJava script at backend   nodejs
Java script at backend nodejs
 
Express js
Express jsExpress js
Express js
 
Non-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.jsNon-blocking I/O, Event loops and node.js
Non-blocking I/O, Event loops and node.js
 
Introduction to Node js
Introduction to Node jsIntroduction to Node js
Introduction to Node js
 
Node.js
Node.jsNode.js
Node.js
 
Node Architecture and Getting Started with Express
Node Architecture and Getting Started with ExpressNode Architecture and Getting Started with Express
Node Architecture and Getting Started with Express
 
Building servers with Node.js
Building servers with Node.jsBuilding servers with Node.js
Building servers with Node.js
 
Communication in Node.js
Communication in Node.jsCommunication in Node.js
Communication in Node.js
 
OSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js TutorialOSCON 2011 - Node.js Tutorial
OSCON 2011 - Node.js Tutorial
 
Introduction to Node.JS Express
Introduction to Node.JS ExpressIntroduction to Node.JS Express
Introduction to Node.JS Express
 
Node ppt
Node pptNode ppt
Node ppt
 
NodeJS
NodeJSNodeJS
NodeJS
 
An Introduction To Testing In AngularJS Applications
An Introduction To Testing In AngularJS Applications An Introduction To Testing In AngularJS Applications
An Introduction To Testing In AngularJS Applications
 
Nodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web ApplicationsNodejs Event Driven Concurrency for Web Applications
Nodejs Event Driven Concurrency for Web Applications
 
Nodejs Explained with Examples
Nodejs Explained with ExamplesNodejs Explained with Examples
Nodejs Explained with Examples
 
Expressjs
ExpressjsExpressjs
Expressjs
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
 
Nodejs vatsal shah
Nodejs vatsal shahNodejs vatsal shah
Nodejs vatsal shah
 
NodeJS: an Introduction
NodeJS: an IntroductionNodeJS: an Introduction
NodeJS: an Introduction
 
Node.js Explained
Node.js ExplainedNode.js Explained
Node.js Explained
 

Ähnlich wie Overview of Node JS

Node JS - A brief overview on building real-time web applications
Node JS - A brief overview on building real-time web applicationsNode JS - A brief overview on building real-time web applications
Node JS - A brief overview on building real-time web applicationsExpeed Software
 
Mastering node.js, part 1 - introduction
Mastering node.js, part 1 - introductionMastering node.js, part 1 - introduction
Mastering node.js, part 1 - introductioncNguyn826690
 
An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)iFour Technolab Pvt. Ltd.
 
Introduction to NodeJS JSX is an extended Javascript based language used by R...
Introduction to NodeJS JSX is an extended Javascript based language used by R...Introduction to NodeJS JSX is an extended Javascript based language used by R...
Introduction to NodeJS JSX is an extended Javascript based language used by R...JEEVANANTHAMG6
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)Chris Cowan
 
S&T What I know about Node 110817
S&T What I know about Node 110817S&T What I know about Node 110817
S&T What I know about Node 110817Dan Dineen
 
Basic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBasic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBhargav Anadkat
 
Node js (runtime environment + js library) platform
Node js (runtime environment + js library) platformNode js (runtime environment + js library) platform
Node js (runtime environment + js library) platformSreenivas Kappala
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed AssafAhmed Assaf
 
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other ThingsI Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other ThingsMichael Lange
 
Node JS Express : Steps to Create Restful Web App
Node JS Express : Steps to Create Restful Web AppNode JS Express : Steps to Create Restful Web App
Node JS Express : Steps to Create Restful Web AppEdureka!
 
3 Things Everyone Knows About Node JS That You Don't
3 Things Everyone Knows About Node JS That You Don't3 Things Everyone Knows About Node JS That You Don't
3 Things Everyone Knows About Node JS That You Don'tF5 Buddy
 
Understanding NuGet implementation for Enterprises
Understanding NuGet implementation for EnterprisesUnderstanding NuGet implementation for Enterprises
Understanding NuGet implementation for EnterprisesJ S Jodha
 
How to Install Node.js and NPM on Windows and Mac?
How to Install Node.js and NPM on Windows and Mac?How to Install Node.js and NPM on Windows and Mac?
How to Install Node.js and NPM on Windows and Mac?Inexture Solutions
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbtFabio Fumarola
 

Ähnlich wie Overview of Node JS (20)

Node JS - A brief overview on building real-time web applications
Node JS - A brief overview on building real-time web applicationsNode JS - A brief overview on building real-time web applications
Node JS - A brief overview on building real-time web applications
 
Mastering node.js, part 1 - introduction
Mastering node.js, part 1 - introductionMastering node.js, part 1 - introduction
Mastering node.js, part 1 - introduction
 
An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)An Introduction of Node Package Manager (NPM)
An Introduction of Node Package Manager (NPM)
 
Introduction to NodeJS JSX is an extended Javascript based language used by R...
Introduction to NodeJS JSX is an extended Javascript based language used by R...Introduction to NodeJS JSX is an extended Javascript based language used by R...
Introduction to NodeJS JSX is an extended Javascript based language used by R...
 
Intro to Node.js (v1)
Intro to Node.js (v1)Intro to Node.js (v1)
Intro to Node.js (v1)
 
S&T What I know about Node 110817
S&T What I know about Node 110817S&T What I know about Node 110817
S&T What I know about Node 110817
 
Basic Concept of Node.js & NPM
Basic Concept of Node.js & NPMBasic Concept of Node.js & NPM
Basic Concept of Node.js & NPM
 
Node js (runtime environment + js library) platform
Node js (runtime environment + js library) platformNode js (runtime environment + js library) platform
Node js (runtime environment + js library) platform
 
React Django Presentation
React Django PresentationReact Django Presentation
React Django Presentation
 
Introduction to node.js By Ahmed Assaf
Introduction to node.js  By Ahmed AssafIntroduction to node.js  By Ahmed Assaf
Introduction to node.js By Ahmed Assaf
 
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other ThingsI Just Want to Run My Code: Waypoint, Nomad, and Other Things
I Just Want to Run My Code: Waypoint, Nomad, and Other Things
 
Node JS Express : Steps to Create Restful Web App
Node JS Express : Steps to Create Restful Web AppNode JS Express : Steps to Create Restful Web App
Node JS Express : Steps to Create Restful Web App
 
3 Things Everyone Knows About Node JS That You Don't
3 Things Everyone Knows About Node JS That You Don't3 Things Everyone Knows About Node JS That You Don't
3 Things Everyone Knows About Node JS That You Don't
 
Node js meetup
Node js meetupNode js meetup
Node js meetup
 
Understanding NuGet implementation for Enterprises
Understanding NuGet implementation for EnterprisesUnderstanding NuGet implementation for Enterprises
Understanding NuGet implementation for Enterprises
 
Node js Global Packages
Node js Global PackagesNode js Global Packages
Node js Global Packages
 
Node js crash course session 1
Node js crash course   session 1Node js crash course   session 1
Node js crash course session 1
 
How to Install Node.js and NPM on Windows and Mac?
How to Install Node.js and NPM on Windows and Mac?How to Install Node.js and NPM on Windows and Mac?
How to Install Node.js and NPM on Windows and Mac?
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbt
 
Modern web technologies
Modern web technologiesModern web technologies
Modern web technologies
 

Kürzlich hochgeladen

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
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, Adobeapidays
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
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 FresherRemote DBA Services
 

Kürzlich hochgeladen (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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
 

Overview of Node JS

  • 2. Node.js is not a silver-bullet new platform that will dominate the web development world. Instead, it’s a platform that fills a particular need.
  • 3. A word of warning There are some really excellent JavaScript people out there. I'm not one of them.
  • 4. Node JS is a powerful tool for controlling web servers, building applications, and creating event- driven programming and it brings JavaScript, a language familiar to all web developers, into an environment independent of web browsers.
  • 5. Node.js® is a JavaScript runtime built on Chrome'sV8 JavaScript engine.
  • 6. Runtime is when a program is running (or being executable).That is, when you start a program running in a computer, it is runtime for that program.
  • 7. Node.js is not a JavaScript framework
  • 8. Node.js allows you to run JavaScript code in the backend, outside a browser.
  • 9. +
  • 10. Node.js ships with a lot of useful modules, so you don't have to write everything from scratch
  • 11. Thus, Node.js is really two things: a runtime environment and a library.
  • 13. V8 TheV8 JavaScript Engine is an open source JavaScript engine developed byThe Chromium Project for the Google Chrome web browser. It has seen used in many other projects, such as Couchbase, MongoDB and Node.js. https://en.wikipedia.org/wiki/V8_(JavaScript_engine)
  • 14. Threading Node is single-threaded and uses a concurrency model based on an event loop. It is non-blocking, so it doesn't make the program wait, but instead it registers a callback and lets the program continue. This means it can handle concurrent operations without multiple threads of execution, so it can scale pretty well.
  • 15. Installing Node If you're using OS X orWindows, the best way to install Node.js is to use one of the installers from the Node.js download page. If you're using Linux, you can use the installer, or you can check Node Source's binary distributions to see whether or not there's a more recent version that works with your system.
  • 17. npm, the official Node package manager npm is the package manager for JavaScript. npm makes it easy for JavaScript developers to share and reuse code, and it makes it easy to update the code that you're sharing.
  • 18. npm, the official Node package manager Node comes with npm installed so you should have a version of npm. However, npm gets updated more frequently than Node does, so you'll want to make sure it's the latest version.
  • 19. npm, the official Node package manager ▪ It installs application dependencies locally, not globally. ▪ It handles multiple versions of the same module at the same time. ▪ You can specify tarballs or git repositories as dependencies. ▪ It's really easy to publish your own module to the npm registry. ▪ It's useful for creating CLI utilities that others can install (with npm) and use right away.
  • 20. Npm behind firewall npm config set proxy http://gateway.zscaler.net:9400 npm config set https-proxy http://gateway.zscaler.net:9400
  • 21. Updating npm npm install npm@latest -g
  • 24. npm init The npm init command is a step-by-step tool to scaffold out your project. It will prompt you for input for a few aspects of the project in the following order:
  • 25. npm init ▪ The project's name ▪ The project's initial version ▪ The project's description ▪ The project's entry point (meaning the project's main file) ▪ The project's test command (to trigger testing with something like Standard) ▪ The project's git repository (where the project source can be found) ▪ The project's keywords (basically, tags related to the project) ▪ The project's license (this defaults to ISC - most open-source Node.js projects are MIT)
  • 26. npm init Once you run through the npm init steps above, a package.json file will be generated and placed in the current directory. If you run it in a directory that's not exclusively for your project, don't worry! Generating a package.json doesn't really do anything, other than create a package.json file.You can either move the package.json file to a directory that's dedicated to your project, or you can create an entirely new one in such a directory.
  • 27. npm init Once you run through the npm init steps above, a package.json file will be generated and placed in the current directory. If you run it in a directory that's not exclusively for your project, don't worry! Generating a package.json doesn't really do anything, other than create a package.json file.You can either move the package.json file to a directory that's dedicated to your project, or you can create an entirely new one in such a directory.
  • 28. npm init options If you invoke it with -f, --force, -y, or --yes, it will use only defaults and not prompt you for any options.
  • 29. package.json package.json file can be described as a manifest of your project that includes the packages and applications it depends on, information about its unique source control, and specific metadata like the project's name, description, and author.
  • 31. package.json package.json also contains a collection of any given project's dependencies.These dependencies are the modules that the project relies on to function properly.
  • 32. package.json - dependencies Dependencies are specified in a simple object that maps a package name to a version range.The version range is a string which has one or more space-separated descriptors. Having dependencies in your project's package.json allows the project to install the versions of the modules it depends on. By running an install command inside of a project, you can install all of the dependencies that are listed in the project's package.json - meaning they don't have to be (and almost never should be) bundled with the project itself.
  • 33. package.json - devDependencies It also allows the separation of dependencies that are needed for production and dependencies that are needed for development. In production, you're likely not going to need a tool to watch yourCSS files for changes and refresh the app when they change.
  • 34. package.json – module version ▪ version Must match version exactly ▪ >version Must be greater than version ▪ >=version etc ▪ <version ▪ <=version~version "Approximately equivalent to version" ▪ ^version "Compatible with version" ▪ 1.2.x 1.2.0, 1.2.1, etc., but not 1.3.0
  • 35. package.json – module version ▪ http://... ▪ * Matches any version ▪ "" (just an empty string) Same as * ▪ version1 - version2 Same as >=version1 <=version2. ▪ range1 || range2 Passes if either range1 or range2 are satisfied. ▪ git... ▪ user/repo See 'GitHub URLs' below ▪ tagA specific version tagged and published as tag ▪ path/path/path
  • 36. Modules - Installation npm install <-g> module name
  • 37. Modules – Installation npm install Once you run this, npm will begin the installation process of all of the current project's dependencies.
  • 38. Modules – Installation Options npm install <module> --save when installing a module: --save, it will install and save it as an entry in the dependencies npm install <module> --save-dev when installing a module: --save-dev, it will install and save it as an entry in the devDependencies
  • 39. Modules – Listing Sometimes is useful to see the list of packages that you have installed on your system.You can do that with the following commands: # list all installed modules with dependencies npm ls # list all installed modules without dependencies npm ls --depth=0 # list all installed globally dependencies npm ls -g --depth=0
  • 40. Extraneous Modules Modules which are installed and are found on node_modules folder, but not included as Dependency or devDependency in package.json
  • 41. Module – uninstallation # uninstall package and leave it listed as dep npm uninstall <package_name> # uninstall and remove from dependencies npm uninstall --save <package_name> # uninstall global package npm uninstall -g <package_name> # remove uninstalled packages from node_modules npm prune
  • 42. Modules – view all versions of an NPM Package The easy way to view all released versions of an npm package is to use the following command npm show <module>@* version
  • 43. Modules - Importing ▪ Java or Python use the import function to load other libraries, ▪ PHP and Ruby use require. ▪ In Node you can load other dependencies using the require keyword.
  • 44. Modules - Importing ▪ For example, we can require some core modules: ▪ var http = require('http'); ▪ var dns = require('dns');
  • 45. Modules - Importing What node.js will do in this case, is to first look if there is a core module named http, and since that's the case, return that directly. But what about non-core modules, such as 'mysql'? In this case node.js will walk up the directory tree, moving through each parent directory in turn, checking in each to see if there is a folder called 'node_modules'. If such a folder is found, node.js will look into this folder for a file called 'mysql.js'. If no matching file is found and the directory root '/' is reached, node.js will give up and throw an exception.
  • 46. Modules - Importing ▪ We can also require relative files: ▪ var myFile = require('./myFile'); // loads myFile.js
  • 47. callbacks In asynchronous programming we do not return values when our functions are done, but instead we use the continuation-passing style (CPS). With this style, an asynchronous function invokes a callback (a function usually passed as the last argument) to continue the program once the it has finished.
  • 48. When Not to Use? ▪ CPU heavy apps ▪ Simple CRUD / HTML apps ▪ NoSQL + Node.js
  • 49. When to Use? ▪ JSON APIs ▪ Single page apps ▪ Streaming Data ▪ Soft Real time Applications
  • 50. ▪ https://www.guru99.com/node-js-tutorial.html ▪ http://www.tutorialsteacher.com/nodejs/nodejs-basics ▪ https://www.javatpoint.com/what-is-nodejs ▪ http://adrianmejia.com/blog/2016/08/19/Node-Package-Manager-NPM- Tutorial/ ▪ https://nodesource.com/blog/an-absolute-beginners-guide-to-using-npm/ ▪ Best Practices ▪ https://www.codementor.io/mattgoldspink/nodejs-best-practices- du1086jja