Professional Documents
Culture Documents
14.1 Apache.. .1 -5
1.4.2 IIS. .. 1 -6
()
2.4.3 Node./s Built in Modules.
Node.js Application. .2-9
2.5 Creating a Simple
2.6 Using Events . . 2-11
2.6.1 Concept of Event Loop.. ..2. 2-1-163
Listeners
2.7
(vi)
3.4 Access Control 3-17
3-29
3.8 Connecting to MongoDB from Node.js.
3.9 Understanding the Objects Used in MongoDB Node.js Driver 3-30
3.11.1 lndexing. . .3 - 41
..... 3 - 44
3.11.2 Aggregation.
3-46
3.11.3 Map Reduce ....
... 3 - 48
3.12 Two Marks Questions with Answers
UNIT IV
Syllabus
Understanding the Basic Web Development Framework - User - Browser - Webserver - Backend
Services - MVC Architecture - Understanding the diferent stacks - The role of Express - Angular -
Node - Mongo DB - React
Contents
1.1 Understanding the Basic Web Development Framework
1.2 User
1.3 Browser
(1-1)
Web Development
1-2
Basics of Full Stack
Full Stack
Database
Browser Webserver
Server-side MySQL
Request
Interacts Javascript) (XML) scripts Oracle
HTML CSS
Files
Response
User
Other
services
1.2 User
" User is an important part of web development framework.
" Users expectations from a website define the requirements for developing a good
website.
Normally an efficient and easy to use website is preferred by the user. They also expect
that the same website must behave closer to the applications installed on their
computers and mobile devices.
" User interacts with the browser by using input devices such as mouse, keyboard on
PC or swipes and taps on mobile devices. The web framework processes the user input
and provides the required visual output.
1.3 Browser
Browser is an application for accessing websites. User interacts with the browser in the
web development framework.
" The browser plays three roles in web framework -
1. It provides communication to and from the web server.
2. It interprets the data from the server and displays the visual output.
3. The browser handles user interaction through the keyboard, mouse, touchscreen or
other input device and takes the appropriate action.
interactivity of user with the web page and provide any necessary logie
required to display the page and provide the functionality.
Media files : These are the files that contain images, videos and audio.
These files can be rendered as webpages.
Data : Any data such as XML, JSON or raw text can be provided to the
web server as a response to an AJAX request.
. HTTP headers : The HTTP headers define the type of data in the request
as well as the type of data expected to be returned back to the browser.
" User interaction : User interacts with the browser with the help of input devices such as
mouse clicks, keyboards, touchscreens. The browser has an event system that captures
the user events and then takes appropriate action. This action can be loading the web
page obtained from the server as aresponse or displaying the pop-up menu.
1.4 Web Server
Web server is a special type of server to which the web browser submits the request of a web
page which
is desired by the client. There are some popularly used web servers such as Apache and
IS from Microsoft.
Functions of web server
Various functions of web server are -
1. The web servers accept the requests from the web browserS.
2. The user request is processed by the web server.
3 The web servers respond to the users by providing the services which they demand for
over the web browsers.
4. The web servers serve the web based applications.
5. The DNS translates the domain names into the IP addresses.
6. The servers verify given address exists, find necessary files, run appropriate scripts,
exchange cookies if necessary and return back to the browser.
7. Some servers actively participate in session handling techniques.
1.4.1 Apache
" It is an excellent server because of its two important features: Reliability and
Effciency.
Secondly it is more popular because it is an open source software. That means it is
freely available to anybody. Apache web server is best suitable for UNIX Systems but it
Similarly, when the data comes browser to the web server in the form of request, then the web
server connects to the database and updates the data.
Review Question
3. Controller: The controller receives input, validates it and then performs business
operations that modify the state of the data model. The controller basically responds to
user requests and performs interaction with the model. Refer Fig. 1.6.1.
alerts Controller
updates
about event model
5. interface.
Customization : It is an extensible and pluggable framework. MVC framewoTk are
can be casily replaced or customized
designed so that the components
Review Questions
Database
Browser Webserver
Angular Node.js
(JSON Request Express MongoDB
Interacts (Javascript) XML webserver
HTML SS Server-side)
scripts
Response
User Files
Other
services
1.7.1 Express
Express is used for server side development in full stack. As it is running in Node.js, it is easy
to configure, implement and control the web application.
Following are the reasons why express is a great framework to start from -
1) Routing : Express JS provides a routing mechanism so that it is possible to reach to
different web pages using the URLs.
2) Error handling : Express provides built-in error handling for documents.
3) Easy integration : Express server can easily be implemented behind an existing reverse
proxy system. This allows it to be easily integrated into your existing secured system.
4) Cookies : Express provides easy cookie management.
5) Session and cache management: Express has session management and cache
management facility.
1.7.2 Angular
Angular is aclient side framework developed by Google. It is written in TypeSeript. angular
provides all the functionalities needed to handle user input in the browser, manipulate data on the
client side. It also controls how elements are di_played in the browser window.
Eollowing are the reasons why MongoDB is a great framework to start from -
1) Document orientation : The data is stored in the document form in the MongoDB.
) High performance : It is the highest
performing database.
3) High scalability : The MongoDB allows horizontal scalability by
sharing data across
multiple servers.
4) High availability : MongoDB provides high availability and redundancy with the help of
replication. That means it creates multiple copies of the data and sends these copies to a
different server so that if one server fails, then the data is retrieved from another server.
1.7.5 React
ReactJS is an open source, component-based front end JavaScript library maintained by
facebook. This library is responsible only for the view layer of the application. That means this
JavaScript is for building user interfaces.
e Following are the reasons why MongoDB is a great framework tostart from -
) Virtual DOM : DOM stands for Document Object Model. It also provides a way to
update the content, structure and style of the document. Virtual DOM is a representation
of the original DOM. When a user updates something on the web application, DOM gets
updated. Updating the DOM is very slow, most of the JavaScript frameworks update the
whole DOM which makes it slower. But actually there is no need to update the whole
DOM, instead, these frameworks should update only the part of DOM that is required to
update. This is what the virtual DOM does. This is why ReactJS's DOM manipulation is
much faster than other frameworks. Due to this property, whenever any change is made
in the web application, then those changes are reflected on the web page within no time.
2) Comnponents : This feature allows the web developer to create custom elements which
can be reused in HTML.
3) JSX: JSX is an extension of JavaScript syntax. JSX can be seen as a
combination of
javascript and XML. The syntax of JSX is very simple that makes writing components
very easy.
4) One way data binding : The ReactJS is designed in such a
way that it follows,
unidirectional one way data binding. That means, data is allowed to flow in one
or
direction at a time. This helps in achieving greater control over the
application. This
makes helps in increasing the efficiency of an application.
Review Questions
sackdevelopment.
ofNodejs infull
1. Eyplaintheuse MongoDB.
note on - frameworks ?
2. Writeshort useful in web
Ghe the reasons - Whyis expressframework.
3. ofreact in web
4. Eyplain the role
Questions with Answers
1.8 Two Marks
development framework ?
Q.1 What is web
" A web development framework is a collection of tools, libraries and technologies that are
Ans. :
3. The browser handles user interaction through the keyboard, mouse, touchscreen or other
input device and takes the appropriate action.
1) Backend services are the services that run behind the web server. These services
provide the
data to the web server which is requested by the web browser.
2) The most comnmonly used backend service is a database that stores the information.
Q.9 What is MVC?
Ans. :
1. Model : This part of the architecture is responsible for managing the application data. This
module responds to the request made from view. The model gives instructions to the
controller to update when the response is made.
2. View: This part takes care of the presentation of data. The data is
presented in desired
format with the help of view. This is a script based system using JSP, ASP, PHP and so on.
3. Controller : The controller receives input, validates it and then
performs business operations
that modify the state of the data model. The controller basically responds to
user requests
and performs interaction with the model.