Unit 1 Notes - Fs
Unit 1 Notes - Fs
BASICS OF FULL STACK Examples include Ruby on Rails, Django, and Laravel.
• ReactJS is an open-source, component-based front end library competitive programming. It is also used as backend language.
responsible only for the view layer of the application. It is maintained by Facebook. • Java
Java is one of the most popular and widely used programming language and
Bootstrap
• Bootstrap is a free and open-source tool collection for creating responsive websites platform. It is highly scalable. Java components are easily available.
• It is the most popular HTML, CSS, and JavaScript framework for developing Python is a programming language that lets you work quickly and integrate
jQuery • Node.js
• jQuery is an open source JavaScript library that simplifies the interactions between ➢ Node.js is an open source and cross-platform runtime environment for
an HTML/CSS document, or more precisely the Document Object Model (DOM), executing JavaScript code outside of a browser.
and JavaScript. ➢ NodeJS is not a framework and it’s not a programming language.
• Elaborating the terms, jQuery simplifies HTML document traversing and ➢ We often use Node.js for building back-end services like APIs like Web App or
manipulation, browser event handling, DOM animations, Ajax interactions, and Mobile App.
cross-browser JavaScript development. ➢ It’s used in production by large companies such as Paypal, Uber, Netflix,
SASS Walmart and so on.
• It is the most reliable, mature and robust CSS extension language. It is used to extend
Back End Frameworks
the functionality of an existing CSS of a site including everything from variables,
The list of back end frameworks are: Express, Django, Rails, Laravel, Spring etc.
inheritance, and nesting with ease.
The other back end program/scripting languages are: C#, Ruby, REST, GO etc.
• Some other libraries and frameworks are: Semantic-UI, Foundation, Materialize,
• Structuring the data in efficient way.
Backbone.js, Express.js, Ember.js etc. • Handle request-response of APIs for storing and retrieve data.
3 4
Security of data is important. • To understand the benefits of utilizing Node.js, MongoDB, and Angular as in web
• Note: JavaScript is essential for all stacks as it is dominant technology on Web. framework, this section provides an overview of the basic components of most
Database websites.
Database is the collection of inter-related data which helps in efficient retrieval, • The main components of any given web framework are: -
insertion and deletion of data from database and organizes the data in the form of tables, i. User,
views, schemas, reports etc. ii. Browser,
Oracle iii. Webserver,
Oracle database is the collection of data which is treated as a unit. The
iv. Backend services.
purpose of this database is to store and retrieve information related to the query. It is a
database server and used to manages information.
• The components are described in a top-down manner from user down to
MongoDB
backend services.
MongoDB, the most popular NoSQL database, is an open source document-
oriented database. The term ‘NoSQL’ means ‘non-relational’. It means that MongoDB
isn’t based on the table-like relational database structure but provides an altogether
different mechanism for storage and retrieval of data.
Sql
Structured Query Language is a standard Database language which is used
to create, maintain and retrieve the relational database.
What is Framework?
• Framework is a platform for developing applications which provides a foundation on
Figure 1.2 The components of a basic website/web application
which software applications can be built.
• The front end frameworks are the software packages that provide-The Reusable code User
modules, standardized front end technologies and Readymade interface blocks for • Users are a fundamental part of all websites; they are, after all, the reason
making the front end development faster and simple. websites exist in the first place.
Basic concept: • User expectations define the requirements for developing a good website, and
• A web development framework is a collection of tools, libraries and technologies that these expectations have changed a lot over the years.
are used to create web applications and websites. • Users used to accept the slow, cumbersome experience of the “world-wide-wait,”
• It provides a basic structure and set of conventions for developers to build web but no longer.
applications quickly and efficiently. • They expect websites to behave closer to applications installed on their computers
5 6
and mobile devices. form.
• The user role in a web framework is to sit on the visual output and interaction input iii. AJAX: Asynchronous JavaScript and Extensible markup language,
In AJAX, the GET or POST request is done directly by
of webpages.
JavaScript runni
• That is, users view the results of the web framework processing and then provide
ng in the browser.
interactions using mouse clicks, keyboard input, and swipes and taps on mobile
• The screen that the user actually views and interacts with is often made up of
devices.
several different pieces of data retrieved from the webserver.
Browser
Browser is an application for accessing websites. User interacts with the browser in • The browser reads data from the initial URL and then renders the HTML document
the web development framework. to build a Document Object Model (DOM).
The browser plays three roles in the web framework, They are: Difference between GET and POST requests
1. It provides communication to and from the webserver. • When a user submits his request using the GET method then the URL string displays
2. It interprets the data from the server and renders it into the view that the the request submitted by the user. But if the POST method is used then URL string
user actually sees. does not show the submitted contents.
3. The browser handles user interaction through the keyboard, • The common browsers are Internet Explorer, Mozilla Firefox, Google Chrome,
mouse, touchscreen, or other input device and takes the appropriate action. Safari.
Browser to Webserver Communication Rendering the bowser view :
i. Browser-to-webserver communication consists of a series of requests using the
• The browser reads data from initial URL and then renders the HTML
HTTP and HTTPS protocols.
document to build the Document Object Model (DOM).
ii. Hypertext Transfer Protocol (HTTP) defines communication between the browser
• The DOM is a tree structured object. The browser interprets each DOM
and the webserver.
element and renders it to user's screen to build a webpage view.
iii. It is a request/response model.
• For example, the document will have html as a child, and html will have
iv. HTTP defines what types of requests can be made by the user as well as the format
head and body as children, and body may have div, p, or other elements as
of those requests and the HTTP response.
children,
v. HTTPS adds an additional security layer, SSL/TLS, to ensure secure connections by
like this:
requiring the webserver to provide a certificate to the browser. document
vi. The user then can determine whether to accept the certificate before allowing the
connection.
vii. The browser makes three main types of requests to the server:
i. GET: The GET request is typically used to retrieve data from the
server, such as .html files, images, or JSON data.
ii. POST: POST requests are used when sending data to the server,
such as adding an item to a shopping cart or submitting a web
7 8
• Browsers get different types of data from multiple web server requests to build the web page which is desired by the client
webpage. • The webserver’s main focus is handling requests from browsers. As described
• The browser interprets each DOM element and renders it to the user’s screen to build earlier, the browser may request a document, post data, or perform an AJAX
the webpage view. request to get a data. The webserver uses the HTTP headers as well as the
• The browser often ends up getting various types of data from multiple webserver URL to determine what action to take. This is where things get different
requests to build the webpage. depending on the webserver, configuration, and technologies used.
The following are the most common types of data the browser uses to render the final user • Most out-of-the-box webservers, such as Apache and IIS, are made to serve
view as well as define the webpage behavior. static files such as .html, .css, and media files. To handle POST requests that
• HTML files: These provide the fundamental structure of the DOM. modify server data and AJAX requests to interact with backend services,
• CSS files: These define how each of the elements on the page is to be webservers need to be extended with server-side scripts.
styled; for example, font, color, borders, and spacing. • A server-side program is really anything that can be executed by the
• Client-side scripts: These are typically JavaScript files. They can provide webserver to perform the task the browser is requesting. These can be written
added functionality to the webpage, manipulate the DOM to change the look in PHP, Python, C, C++, C#, Java, ... the list goes on and on. Webservers
of the webpage, and provide any necessary logic required to display the page such as Apache and IIS provide mechanisms to include server-side scripts
and provide functionality. and then wire them up to specific URL locations requested by the browser.
• Media files: Image, video, and sound files are rendered as part of the webpage. Functions of web server
Various functions of web server are
• Data: Any data, such as XML, JSON, or raw text, can be provided by the
1. The web servers accept the requests from the web browsers.
webserver as a response to an AJAX request.
2. The user request is processed by the web server.
• HTTP headers: The HTTP protocol defines a set of headers that can be used
by the browser and client-side scripts to define the behavior of the webpage. For 3. The web servers respond to the users by providing the services which
example, cookies are contained in the HTTP headers. The HTTP headers also they demand
define the type of data in the request as well as the type of data expected to be for over the web browsers.
returned back to the browser. 4. The web servers serve the web based applications.
User Interaction 5. The DNS translates the domain names into the IP addresses.
• The user interacts with the browser via input devices such as mice, 6. The servers verify given address exists, find necessary files, run
keyboards, and touchscreens. appropriate scripts, exchange cookies if necessary and return back to the
browser.
• The browser has an elaborate event system that captures these users input
events and then takes the appropriate action. 7. Some servers actively participate in session handling techniques.
• Actions vary from displaying a popup menu to loading a new document Apache
• It is an excellent server because of its two important features: Reliability and
from the server to executing client-side JavaScript.
Efficiency.
Webserver
• Secondly it is more popular because it is an open source software. That
• Web server is a special type of server to which the web browser submits the request of a
9 10
means it is freely available to anybody. Apache web server is best suitable for in the database, the server-side script connects to the database and updates
UNIX systems but it can also be used on window box the apache web server the data.
can be configured as per the requirements using the file httpd.conf. This MVC ARCHITECTURE
file is present in the Apache software package. The Model-View-Controller (MVC) is an architectural pattern that separates an
IIS application into three basic components:
• Model
The internet in information services or internet information server is a kind of web
• View
server provided by Microsoft. This server is most popular on the Windows
• controller.
platform.
Each of these components are built to handle specific development aspects of an
Differnces between Apache and IIS servers –
application. MVC is one of the most frequently used industry-standard web development
Sr.No Apache web server IIS web server framework to create scalable and extensible projects.
Backend Services
• Backend services are services that run behind the webserver and provide data Model:
used to build responses to the browser.
• This part of the architecture is responsible for managing the data of the application
• The most common type of backend service is a database that stores domain.
information.
• When a request comes in from the browser that requires information from • This module responds to requests for information about its state (usually from the
the database or other backend service, the server-side script connects to view).
the database, retrieves the information, formats it, and then sends it back • This model gives instructions to the controller to update when the response is made.
to the browser. • In event — driven systems, the model notifies observers (usually views) when the
information changes so that they can react.
• Similarly, when data comes in from a web request that needs to be stored
11 12
In MVC Architecture,
▪ Model represents the data
▪ View is the user interface
▪ Controller is the request handler.
• The controller basically responds to user requests and performs interaction with the
model receives user input and initiates a response by making calls on model objects.
• A controller accepts input from the user and instructs the model and viewport to perform
actions based on that input.
Fig 1.4 MERN Stack
13 14
The MERN stack consists of the following technologies: ➢ LAMP Stack: Linux, Apache, MySQL and PHP.
• MongoDB: A document-based open source database. UNDERSTANDING THE NODE.JS-TO-ANGULAR STACK COMPONENTS
• Express: A web application framework for Node.js.
• React: A JavaScript front-end library for building user interfaces. Node.js-to-Angular stack comprised of MongoDB, Express, Angular, and Node.js.
• Node.js: JavaScript run-time environment that executes JavaScript code In the Node.js-to-Angular stack,
outside of a browser (such as a server). • Node.js provides the fundamental platform for development. The backend
It is also common to use Mongoose, which is a simple, schema-based solution to model services and server-side scripts are all written in Node.js.
application data. • MongoDB provides the data store for the website but is accessed via a MongoDB
MVC and MERN driver Node.js module.
MERN isn’t an MVC framework in the traditional sense, because it spans both the server • The webserver is defined by Express, which is also a Node.js module.
and the browser. MVC can also be achieved by sticking to server-side templating in Node, and • The view in the browser is defined and controlled using the Angular framework.
just sending the HTML to the browser and treating the browser as the View layer i.e. doing • Angular is an MVC framework where the model is made up of JSON or
things the way things have always been done forever. JavaScript objects, the view is HTML/CSS, and the controller is made up of
Although, when React is combined with a javascript backend, then it is MVC. React serves Angular JavaScript.
as the “V” in the MVC
• Mongoose’ models defines the data part. This is where we will store all of the crucial
data our application needs to function.
• Express & Node.js does all the functional programming and will be used to write
the Business Logic Tier (controller). This tier represents the Application Server that
will act as a bridge of communication for the Client and Database. This tier will
serve the React components to the user’s device and accept HTTP requests from the
user and follow with the appropriate response.
• React serves as the “V” in the MVC. Our Client tier (View) will be written in
JavaScript, HTML, and CSS, using ReactJS as the framework. This level of the
architecture is what the user will interact with to access the features of our
application.
UNDERSTANDING THE DIFFERENT STACKS
Popular Stacks Basic diagram showing where Node.js, Express, MongoDB, and Angular fit
➢ MEAN Stack: MongoDB, Express, AngularJS and Node.js. in the web paradigm
server and vice versa. Also, your client developers and server developers will be • Especially today when more and more people interact with websites, it is
speaking the same language. important to have a backend that can support heavy traffic.
• Node.js applies a different logic to handling web requests. Rather than having • MongoDB’s replication model makes it easy to maintain scalability while
multiplethreads waiting to process web requests, they are processed on the same keeping high performance. That means it creates multiple copies of the
thread using a basic event model. data and sends these copies to a different server so that if one server
fails, then the data is retrieved from another server.
Extensibility:
High scalability:
• Node.js has a great following and an active development
community. New modules to extend Node.js functionality are being • MongoDB’s structure makes it easy to scale horizontally by sharing the data
• The following is a partial list of the valuable features of Express: of the language to provide your own custom implementations.
Route management: Clean: Angular forces you to write clean, logical code.
Express makes it easy to define routes (URL endpoints) that tie directly Reusable code: The combination of extensibility and clean code makes it easy to write
to Node.js script functionality on the server. reusable code in Angular.
Error handling:
Support: Google is investing a lot into this project, which gives it an advantage over
Express provides built-in error handling for documents not found and other
errors. other similar initiatives.
Easy integration: Compatibility: Angular is based on Type Script, which makes it easier to begin
An Express server can easily be implemented behind an existing reverse integrating Angular into your environment and to reuse pieces of your existing code within
proxy system such as Nginx or Varnish. This allows it to be easily the structure of the Angular framework.
integrated into your existing secured system. REACT JS
Cookies • ReactJS is a declarative, efficient, and flexible JavaScript library for building
Express provides easy cookie management.
reusable UI components.
Session and cache management
Express also enables session management and cache management. • It is an open-source, component-based front end JavaScript library. This library
responsible only for the view layer of the application. That means this
JavaScript is for building for interfaces.
Angular • It was created by Jordan Walke, who was a software engineer at Facebook.
• Angular is a client-side framework developed by Google. • It was initially developed and maintained by Facebook and was later used in
• It is written in TypeScript. its products like WhatsApp & Instagram.
19 20
• Today, most of the websites are built using MVC (model view controller)
architecture. In MVC architecture,
• React is the 'V' which stands for view, whereas the architecture is provided
by the Redux or Flux.
• A ReactJS application is made up of multiple components, each component
responsible for outputting a small, reusable piece of HTML code.
• The components are the heart of all React applications. These Components
can be nested with other components to allow complex applications to be
built of simple building blocks.
• ReactJS uses virtual DOM based mechanism to fill data in HTML DOM. The
virtual DOM works fast as it only changes individual DOM elements instead of
reloading complete DOM every time.
• To create React app, we write React components that correspond to various
elements. We organize these components inside higher level components which
define the application structure.
*****************
21