Aad
Aad
Fille.The
Node.js Event Loop.The I/O Cycle.The Anatomy of a Node.is Module.Creating Node
Modules,Exploring the Node.js HTTP Module.Creating an HTTP Webserver with Node.js
Responding to HTTP Requests.Routing in Node.js.Creating a Sample Node.js
Application. MongoDB(M):Introduction to MongoDB.Installing MongoDB.Using
MongoDB Compass.
Using Mongo Interface.Connecting MongoDB.Creating Schemas and Models.
Shell Querying to Using Documents Usingcreate().Updating
Documents find().Inserting
Docum Using findOneAndUpdate().Deleting Documents Using
ents deleteMany() findOneAndDelete()&
Server-Side Development with Express (E):Introduction to the Express 15
II Framework. Installing and TestingExpress. Creating a Node.js Express App
Restructuring anExpress App.Creating Templates.Using Express
Middleware
Functions.Creating the List Page.Creating the Details Page.Creating the
Edit Page
Creating the AddPage.DeletingData.REST API Basics.Testing
REST APIs Refactoring APIs
Understanding Angular.JS(A):Getting Started with Angular.Creating
an Angular Application.Angular Project File Structure.Anatomy of an
Angular
Component.One-way Data Binding.Two-way Data Binding.Using Nglf
Directive.
Using NgForOf Directive.Anqular Modules.Creating NgModules Using
Angular Router Configuring Templates.Creating Navigations.Working
with Template-driven Forms. Working with Reactive Forms.Validating
Form Data.Services Dependency Injection
(DI).Reading Data from Database.Inserting Data into Database.Updating
Data in the Database.Delete Data from Database.
UNIT III;
Understanding Flutter:Importance of Flutter,Flutter
Framework,Android Studio, Flutter SDK,Installing and Configuring
Flutter SDK.
Dart Programming:main()function,Dart Variables,DartData Types,Dart
Conditional Operators,Control Flow &Loops.Dart Functions -
Functions,Function
Structure,creatinga Function,Function Expression.Object-
Returning Oriented to
Programming(OOP)-Creating a Class,Adding Classes,Class —Getters
Methods
and Setters,Class Inheritance,Abstract Class, Widget,Container Widget
Flutter Widgets Fundamentals:Scaffold
Widget,Image
Column and Row Widgets,Icon Widget,Layouts in Flutter,Card
Widget,Hot Reload and Hot Restart,Stateful and Stateless Widgets
Navigation and Routing:Button Widget,App Structure and
Navigation,Navigate to
a New Screen and Back,Navigate with Named Routes,Send and
Return Data among Screens,Animate a Widget across
Screens,WebView Widget in Flutter
Textbooks:
1.Node.js,MongoDB and Angular Web Development:The definitive guide to
using the MEAN stack to build web applications by Brad
Dayley,Brendan Dayley,Caleb Dayley, Pearson,2018.
2.Beginning Flutter;A Hands On Guide to App Development by
Marco L.Napoli, Wrox,2019
Additional References:
1.Full Stack Javascript Development with Mean -
MongoDB,Express,AngularJS,and Node.JS by Adam Bretz,Colin J
Ihrig,Shroff/SitePoint,2015
2.Practical Flutter by Zammetti Frank,Apress,2019
SADVANCED APPLICATION DEVELOPMENT QBA NOTES!BY.PROF,AJAY PASHANKAR
CHAPTERI:INTRODUCTION TO NODE.JS(N)
Q.Explain Node
Node.is is a development framework based on Google's V8 JavaScript engine.
Therefore,Node.js code is written in JavaScript and then complled intolmachine code by V8 to
execute
Many of your backend services can be written in Node.is,as can the server-side scripts and any
supporting web application functionality.The nice thing about Node.is is that it is all just
so you can easily take functionality from a client-side script and place it in a server-side
the webserver can run directly within the Node.js platform as a Node.is module,so it makes it
easier than,say,Apache at wiring up new services or server-side
The following are just a few reasons why Node.js is a great framework to start
JavaScript end-to-end: One of the biggest advantages to Node.js is that it allows you to
both server-and client-side scripts in JavaScript.There have always been difficulties in
where to put scripting logic.Too much on the client side makes the client cumbersome
unwieldy,but too much on the server side slows down web applications and puts a heavy burden
the webserver.With Node.is you can take JavaScript written on the client and easily adapt it for
server and vice versa.Also,your client developers and server developers will be speaking the same
language.
Event-driven scalability: Node.js applies a different logic to handling web requests.Rather than
havina multiple threads waiting to process web requests,they are processed on the same thread
using a basic event model.This allows Node.is webservers to scale in ways that
webservers never can.This
is discussed in more detail in later chapters.
Extensibility: Node.js has a great following and an active development community.New modules
to extend Node.is functionality are being developed all the time.Also it is simple to install
and include new modules in Node.js,making it easy to extend a Nodejs project to include
new functionality in minutes.
· Time: Let's face it,time is valuable.Node.js is super easy to set up and develop in.In only a few
minutes,you can install Node.is and have a working webserver.
Who Uses
·Node.js quickly gained popularity among a wide variety of companies.These companies use Node.js
first and foremost for scalability but also for ease of maintenance and faster development.The
following are just a few of the companies using the Node.js technology:
·Yahoo!
·L
e Bin eyd
in
inary
r
macos g
Step-2:Ru
Now nning
you need to the N othe2 ,jsnode.js installer on your PC.You need to follow the following steps for the
install ( ta
instalier click
·Double on the ,msl installer.
The Node.js Setup wizard will open.
.Welcome To Node.js Setup Wizard.
Page 5 of
www.profajaypashankar.com
279
ADVANCED APPLICATION DEVELOPMENT O&A NOTES;BY.PROF,AJAY PASHANKAR
elect "Next"
Node js Setup ×
,Destination Folder
Set the Destination Folder where you want to install Node.js &Select "Next"
Page 6 of 279
www.profaiaypashankar.com
D APPLICATION DEVELOPMENT OAA NOTEL
WANeED APPL OPMENT QBA NGTESi
F hOE,AAAYEASAANKAR
AD ×
on
Destncstom location or dck Next tonstall.
A ade
Nte s to:
C:Program Fles'nodejs\
Change …
Next Cancel
×
·Custom Setup
A ode
subfeatures
up
》
Ready to Install
Select "Install"
Page 7 of 279
www.profaiaypashankar.com
BY.PROF.AJAY
PASHANKAR VANCED APPLICATION DEVELOPMENT S&A NOTES: ×
×
NOTE:
www.profajaypashankar.com Page 8 of
ON DEVELOPMENT Q&A NOTES: BY.PROF,AJAY PASHANKAR
5.
ff node.js was completely installed on your system,the command prompt will print the version ôf
Ehe node.js installed.
Step 4:Updating the Local npm version.
The final step in node.js installed is the updation of your local npm version(if required)-the package
Imanager that comes bundled with Node.js.
You can run the following command,to quickly update the npm
npm install npm -global //Updates the 'CLI'client
NOTE:
You do not need to do anything to the system variables as the windows installer takes care
the system variables itself while
f installing through the .msi installer
of
·If u use any other format o r installing node.js on your PC,you should put the system variable
p a ho fo r as
node.js
PATH:C:|UserslIusername]|AppData\Roaming\npm
C:|Program Fileslnodejs (Path to the nodejs folder)
0.Explain NPM?
Using the Node Package Manager
The Node Package Manager you have already seen is a command-line utility.It allows you to find,
install,remove,publish,and do everything else related to Node Package Modules.The Node
Package Manager provides the link between the Node Package Registry and your development
environment.
The simplest way to really explain the Node Package Manager is to list some of the command-
line options and what they do.You use many of these options in the rest of this chapter and throughout
the book.Table 3.1 lists the Node Package Manager commands.
Table 3.1 npm command-line options(with express as the package,where appropriate)
Page 9 of 279
www.profaiaypashankar.com
npm
linstall
Installs a package either using a
[package.j son file,from the repository,
npm install
or a local location npm install
express
p
m
n ll
express @ ins 0 ta 1.1
npm install
../tModule.tgz
- Installs a package globally
npm install
express -g
remove Removes a module npm remove
[Pack express
Packages the module defined by the
package.json file into a.tgz file npm
Displays module details
npm view
publish [express
Publishes the module defined by a
package.json file to the registry
unpublish
Unpublishes a module you have published
npm unpublish
myModule
[owner
Allows you to add,remove,and list own ers
of a package in the repository npm add
bdayley
myModu
ammand prompt using the npm search <search_string>、command.For example,the following
mand searches for modules related to openssl and displays the results as shown in Figure 3.2:
barch openssl
Page 10 of
www.profajaypashankar.com
SY CS ADVANCED APPLICATION DEVELOPMENT Q&ANOTES: BY.PROF.AJAY
I
PASHANKAR V
co c
NAMF
bignum
DESCRIPTION
Arbitrary-precision integer arithmetic using OpenSSL
c
ertgen Certificate generation library that uses the openssl command
ipherpipe Thin wrapper around openssl for encryption/decryption
sr Read csr file
sr-gen Generates QpenSSL Certificate Signing Requests
rypt extended openss]bindings
xedentropy js //V8 supports custom sources of entropy.//by default
ckbox Simple,strong encryption.
Q,Explain Package.json?
图 Defining packages with package.json
In every Node application there should be a file in the root folder of the application called Package,json,
This file can contain various metadata about a project,including the packages that it depends on to run,
The following listing shows an example package.
json file that you might find in the root of a new Express project.
{
"name":"application-name",
"version":"0.0.0",
"private":true,
"scripts":{
"start":"node./bin/www"
M
"dependencies":{
"express":"~4.9.0",
"body-parser":"~1.8.1",
"cookie-parser":"~1.3.3",
"morgan":"~1.3.0",
to
Licensed to Marwk wWwa.tist-oenb o<[email protected]>
"serve-favicon":"~2.1.3",
"debug":"~2.0.0",
"jade":“~1.6.0”
Ⅱ [
Ⅱ
This is the file in its entirety,so it's not particularly complex,There's various metadata at the top of
the file followed by the dependencies section.In this default installation of an Express project there
are quite a few dependencies.Express itself is modular so that you can add in components or upgrade
them individually,
WORKING WITH DEPENDENCY VERSIONS IN PACKAGE.JSON
Alongside the name of each dependency is the version number that the application is
going to use.Notice that they're all prefixed with a ~.
Let's take a look at the dependency definition for Express 4.9.0.It specifies a particular p
version at three levels:
Major version (4) e
■Minor version (9)
Patch version (O)
Prefixing the whole version number with a ~is like replacing the patch version with a wildcard,which
means that the application will use the latest patch version available.
This is considered best practice,as patches should only contain fixes that won't have any impact on the
application.But different major and minor versions could well include changes that cause problems
with [the application,so you want to avoid automatically using later versions of these.
What is Node js?
Node js is an open source server environment
Node js is free
It is developed by Ryan Dahl in the year 2009 and v22.4.1 is the latest version of
Node js.Because it is cross-platform one can easily run on
Windows,Linux,Unix,
macOS and more.
Node js uses JavaScript on the server
it runs on Chrome's V8 JavaScript engine.
Why Node.js?
Node js uses asynchronous programming!
A common task for a web server can be to open a file on the server and return the
content to the client.
Node js has a unique advantage because millions of frontend developers who
write JavaScript for the browser can now write server-side code without needing to
learn a completely new language.Node js is one of the popular choices for
developing
RESTful APls,microservices and web application.
Application of Node.JS
Node js is suitable for various applications,including:
Real-time chats
Complex single-page applications
Real-time collaboration tools
Streaming apps
JSON APls
Node js is used to build back-end services like APls like Web App,Mobile App
or Web Server.A Web Server will open a file on the server and return the content
to
the client.It's used in production by large companies such as
Paypal,Uber,Netflix, Walmart,and so on.
Node.JS Ecosystem
Node js has a vibrant ecosystem with a plethora of libraries,frameworks,and
9
tools. Here are some key components:
9
npm(Node Package Manager):npm is the default package manager for
Nodejs.It allows developers to install,manage,and share reusable code
packages (called
modules).You can find thousands of open-source packages on the npm registry.
Express js:Express is a popular web application framework for Node,js.It simpifies
routing,middleware handling,and requestresponse management.Many
developers choose Express for building APIs,web servers,and single-page
applications.
Socketio:For real-time communication,Socketio is a go-to library.It enables
bidirectional communication between the server and clients using WebSockets
or fallback mechanisms.
Mongoose:If you're working with MongoDB(a NoSQL database),Mongoose
provides an elegant way to model your data and interact with the database.It
offers schema validation,middleware,and query building.
Installing Node.js
To begin using Node.js,you need to install it on your system.
Verify the installation by running the following command in your terminal or
command prompt:
node -v
This should dispiay the installed version of Node.js.
myfrstjs
http.createServer(function (req,res){
res.writeHead(200,{Content-Type':'text/html});
res.end(Hello World!!);
}).listen(8080);
Save the file on your computer:C:UserslYour Namelmyfirst.js
The code tells the computer to write "Hello World!"if anyone (e.g.a web
browser) tries to access your computer on port 8080.
Navigate to the folder that contains the file "myfirstjs",the command line
interface window should look something like this:
C:lUserslYour Name>_
Initiate the Node,js File
The file you have just created must be initiated by Node js before any action can
take place.
Start your command line interface,write node myfirst js and hit enter:
If anyone tries to access your computer on port 8080,they will get a "Hello World!"
message in return!
Built-in Modules
Node js has a set of built-in modules which you can use without any further
installation.
Include Modules
To include a module,use the require()function with the name of the module:
var http=require(http');
Now your application has access to the HTTP module,and is able to create a
server:
http.createServer(function (req,res){
res.writeHead(200,{Content-Type':"text/html});
res.end(Hello World!!);
}),listen(8080);
Create Your Own Modules
You can create your own modules,and easily include them in your applications.
The following example creates a module that returns a date and time object:
Example
Create a module that returns the current date and time:
Use the exports keyword to make properties and methods available outside
the module fle.
Example
Use the module "myfirstmodule"in a Node js file:
http.createServer(function (req,res){
res.writeHead(200,{Content-Type':text/html});
res.write("The date and time are currently:"+dt.myDateTime());
res.end();
}).listen(8080);
Notice that we use./to locate the module,that means that the module is located
in the same folder as the Node.js file.
Save the code above in a file called "demo_module,js",and initiate the file: