[go: up one dir, main page]

0% found this document useful (0 votes)
18 views18 pages

Node js

Node.js is an open-source, cross-platform runtime environment that allows JavaScript to be executed outside the browser, primarily for building back-end services like APIs. It is built on Google's V8 engine, providing fast execution and scalability, and is widely used by major companies such as Netflix and PayPal. Node.js supports various modules, including core, local, and external modules, enhancing its functionality and ease of use in application development.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views18 pages

Node js

Node.js is an open-source, cross-platform runtime environment that allows JavaScript to be executed outside the browser, primarily for building back-end services like APIs. It is built on Google's V8 engine, providing fast execution and scalability, and is widely used by major companies such as Netflix and PayPal. Node.js supports various modules, including core, local, and external modules, enhancing its functionality and ease of use in application development.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Node js

By Komal Singh
What is Node js?
 Node is not a language
 Node is a server environment
 Node js can connect with the database
 Code and syntax is very similar to javascript but not
exactly the same.
 Node js free ,open source
 Node js use chrome’s v8 engine to execute code.
 Node JS provides fast and highly scalable services.
 The source code in node js is more consistent and clean.
 It provides a large ecosystem for open source libraries.
Definition of node js

 Node JS is an open-source and provides a cross-


platform runtime environment that helps for
executing javascript code outside the browser.
 Hence it is not the framework and its not a
programming language. Most of the time node js
are used as building back end services like APIs
(Web App or Mobile App).
 Large companies like Netflix, Wallmart, PayPal, Uber
use the node js.
Why do we use Node
 NodeJs is built on Google Chrome’s V8 engine, and for
this reason its execution time is very fast and it runs
very quickly.
 Node js is mostly used for API.
 So we can connect the same databse with web
app,mobile app.
 Node js is easy to understand who know javascript.
 Node js is superfast for APIs.
 With node and javascript ,you became the full stack
developer.
 NodeJS Applications:
 Complex single-page applications.
 Real-Time Chats.
 Real-time collaboration tools.
 JSON APIs based application.
 Streaming apps.
Success Stories…..
Advantages of node js
 Less Learning Curve
 Fast Development
 Scalability
 High Performance
 Real-Time Applications
 Great for Microservices
 Easy Maintainability
 Extensive Libraries
 Vast Community
 Cross-Platform
 Highly Extensible
Node Js : Modules
 What is module in node js?
 Module in Node.js is a simple or complex
functionality organized in single or multiple
JavaScript files which can be reused throughout the
Node.js application.
 Node.js Module Types
 Node.js includes three types of modules:
 Core Modules/Built-in Modules
 Local Modules
 Third Party Modules/External Modules
Node.js Core Modules
 Http Module:
 It allows node.js applications to transfer data using HyperText
Transfer Protocol (HTTP).
 This module creates an HTTP server that listens to server ports
and also gives responses back to the client.
 Syntax : const http = require("http")
 Distributed with node js itself
 Core components of node js
 Maintained by core contributors to the language
 Only changes with new release of node js
The url module

 We can use the url module for parsing.


 This is a built-in module of node.js. It breaks down the url into
readable parts. It is included in the file by using the require
function;
 To Parse an address, use the url.parse() method. It will return a
URL object with each part of the address as its properties.
 It is one of the core Node.js module.
 So, we don't have to install it using NPM.
 We write the following to require the url module.
 Syntax :
 const url = require('url');
The following table lists some of the
important core modules in Node.js.
Core Module Description
http http module includes classes, methods
and events to create Node.js http
server.
url url module includes methods for URL
resolution and parsing.
querystring querystring module includes methods
to deal with query string.
path path module includes methods to deal
with file paths.
fs fs module includes classes, methods,
and events to work with file I/O.
util util module includes utility functions
useful for programmers.
Node.js Local Modules

 Local modules are the modules that you define.


 It makes your code easily reusable
 To use local modules in your application, you need to load it
using require() function in the same way as core module.
 However, you need to specify the path of JavaScript file of the
module.
 Syntax:
 var mynewModule = require('./Log.js');
 mynewModule.info('Node.js started');
 In the above example, app.js is using log module.
 First, it loads the logging module using require()
function and specified path where logging module is
stored.
 Logging module is contained in Log.js file in the root
folder.
 So, we have specified the path './Log.js' in the
require() function. The '.' denotes a root folder.
Node.js External Modules
 External modules are also known as third party modules and
require a package manager that maintains all the modules so that they
can be accessed with ease.
 By default, node.js uses NPM [node package manager) package
manager for JavaScript runtime environment.
 The third-party module can be downloaded by NPM (Node Package
Manager).
 Some of the most popular third-party modules are:
 Express
 Socket.io
 Mongoose
 Third party modules can be install inside the project folder or globally.
Below are some differences between
Node.JS and JavaScript:
Features JavaScript Node JS

Definition It is an open-source, cross- It is a cross-platform, open-source


platform, interpreted, lightweight JavaScript runtime environment
scripting programming language that allows JavaScript to be run
that is used to develop dynamic on the server.
and web applications.

Type It is a programming language. It It's a JavaScript interpreter and


works in any browser that has a environment with some valuable
proper browser engine. libraries that JavaScript
programming can use separately.

Dedicated Server It is generally used on the client- It is generally used on the server-
side server. side.
Community All the JavaScript is not important to the node All node projects represent the JavaScript community.
community.

Running Engines JavaScript can be run on any engine, including Spider Node JS is only supported by the V8 engine, which
Monkey, V8, and JavaScript Core. Google Chrome mostly uses. Any JavaScript program
written with Node JS will always be run in the V8
engine.

Used for It is designed to build network-centric applications. It's designed for data-intensive real-time applications
that run on several platforms.

Languages It's a newer version of the ECMA script that runs on It uses C, C++, and JavaScript.
Chrome's V8 engine, which is written in C++.

Modules Few JavaScript frameworks are TypedJS, RamdaJS, Lodash, express are examples of Nodejs modules.
etc. These all modules are to be imported from npm.

Companies Uses Various companies use JavaScript like Google, Various companies use Node Js like Netflix, Hapi,
Shopify, Udacity, Sendgrid, Groupon, Okta, Walmart, Paypal, Linkedin, Trello, Medium, eBay,
Instacart, etc. etc.

You might also like