Full Stack Web Development -2024_05
Full Stack Web Development -2024_05
TECHNOLOGY
COLLEGE OF TECHNOLOGY
SPA -MPA -PWA
• SPA - single-page application is an app that doesn’t
need to reload the page during its use and works
within a browser. Ex: Facebook, Google Maps, Gmail,
Twitter, Google Drive, or even GitHub.
• the website
• the registry
• Use the website to discover packages, set up profiles, and manage other aspects of your
npm experience. For example, you can set up organizations to manage access to public or
private packages.
• The CLI runs from a terminal, and is how most developers interact with npm.
• The registry is a large public database of JavaScript software and the meta-information
surrounding it.
• A framework is a supporting structure around which something can
be built
•
• the difficult part of architecting apps is making sure
data flows and is refreshed in the UI in a consistent
way. This process is called state management
REACT
• A JavaScript library for building user interfaces
• An ideal tool for those who anticipate high traffic and need a stable
platform to handle it.
PROS AND CONS
When to use React:
• React is used for building the user interface, especially when you want
to develop single-page applications.
• When you don’t have hands-on experience with Javascript, React isn’t
the recommended option.
• Unlike React, Angular is unique with its two-way data binding feature. It means
there is a real-time synchronization between the model and the view,
where any change in the model reflects instantly on the view and vice versa.
• For enterprise based applications and dynamic web apps, using Angular is the best
bet.
• If you want to build applications with limited scopes, you will not be able to use the
resources that Angular provides.
• Also, when you have a more minor size team, opt for a smaller framework with
fewer complexities and simple syntax.
PREREQUISITES FOR
ANGULAR
MVC
BACKEND
• Object Relational Mapper/ Object Document Mapper
CRUD and REST
• two prominent concepts in the API industry, are often confused. Whereas
REST is one of the most popular design styles for web APIs (among other
applications), CRUD is simply an acronym used to refer to four basic
operations that can be performed on database applications: Create, Read,
Update, and Delete.
• Create, Read, Update, and Delete — or CRUD — are the four major
functions used to interact with database applications. The acronym is
popular among programmers, as it provides a quick reminder of what data
manipulation functions are needed for an application to feel complete.
• The five basic constraints that define a REST application are:
1. Client-Server: The client and server act independently.
2. Stateless: The server does not record the state of the client.
4. Uniform Interface: The client and server interact in a uniform and predictable way. An
important aspect of this is that the server exposes resources.
5. Layered System: The application behaves the same regardless of any intermediaries
between the client and server.
• Although there are numerous definitions for each of the CRUD functions,
the basic idea is that they accomplish the following in a collection of data:
NODE.JS
NODE.JS
Node.js is an open-source,
cross-platform, back-end
JavaScript runtime environment
that runs on the V8 engine and
executes JavaScript code
outside a web browser
As an asynchronous event-
driven JavaScript runtime,
Node.js is designed to build
scalable network applications.
ADVANTAGES
• Node.js is an open-source, cross-platform, back-end JavaScript runtime environment
that runs on the V8 engine and executes JavaScript code outside a web browser.
• Node.js lets developers use JavaScript to write command line tools and for server-side
scripting, running scripts server-side to produce dynamic web page content before the
page is sent to the user's web browser.
• Though .js is the standard filename extension for JavaScript code, the name "Node.js"
doesn't refer to a particular file in this context and is merely the name of the product.
Node.js has an event-driven architecture capable of asynchronous I/O.
• These design choices aim to optimize throughput and scalability in web applications
with many input/output operations, as well as for real-time Web applications (e.g., real-
time communication programs and browser games)
NPM
NODE RUNTIME ENV.
Module creation
MODULE WRAPPER
PATH MODULE
FS MODULE
Read and Rename File
OS MODULE
URL Module
Module creation/Exporting fonction
Synchronous and Asynchronous Calls
Events
Principle
EVENT EMITTER
Class Raising Event
Registering the listener
HTTP MODULE
STARTING A SERVER
npm install -g nodemon
After Importing http, Path and
FS
Serving an API
instead
GENERATE THE FOLLOWING index.html
file WITH ! (FOR EMMET EXTENSION )
Synchronously reading HTML
File
Universal File loader
INCLUDE CSS
Using the ES6 Notation
EXPRESS
• EXPRESS is a Fast, unopinionated, minimalist web framework for Node.js
• Express JS is a small framework that works on top of Node web server functionality to simplify its APIs and
add helpful new features. It makes it easier to organize your application’s functionality with middleware and
routing. It adds helpful utilities to Node HTTP objects and facilitates the rendering of dynamic HTTP objects.
• Express makes the development of Node application very easy and it is very simple to use. It provides a
simple and efficient way to build web applications and APIs using JavaScript.
CLIENT-SERVER BACK-END
TRANSACTION THROUGH API
Restful API with Express
•
RENDERING HTML PAGE
Rendering a static Folder
with the Middle layer (USE)
Multiple Parameters
Multiple Routes
•
API WITH EXPRESS
•
Include bootstrap for styling with template string
main.handlebars
index.handlebars
Rendering Handlebars
Title & Members
The Index.handleBar
•
Redirect to home (‘/’)
Passport could be added for Authentication
Postman
The Collaboration Platform for API Development
FORM VALDATION WITH JOI: npm install
joi
UPDATE
UPDATE
POST MODIFIED
DELETE
MongoDB
• SQL databases are used to store structured data
while NoSQL databases like MongoDB are used
to save unstructured data.
• https://www.youtube.com/watc
h?v=bqn-sx0v-
l0&ab_channel=TraversyMedi
a
• https://www.youtube.com/watc
h?v=oyYOobBuczM&t=13s&a
b_channel=TraversyMedia
Build A REST API With Node.js,
Express, & MongoDB - Quick
• ..
REACT
• React is a JavaScript library
for building user interfaces.
Inline Styling
A Hook is a special function that lets you “hook into” React features. For exa
If you write a function component and realize you need to add some state to
UseState Implementation
Restructuring it to send the list of
Students at App.js
Event Handling
With UseState and Props propagation
(App.js; List.js and Student.js)
Handling Events: deleteStudent/onDelete
Handling Events: propagating onDelete on the list
Handling Events: propagating onDelete on the list
Event Handling for Check Box
With UseState and Props propagation
(App.js; List.js and Student.js)
App.js
List.js
Student.js
FORMS: Create Component(AddStudent)
AddStudent Component (form Container)
AddStudent Component (form Container)
AddStudent Component (form Container)
Export to Production
npm i json-server
npm run build
npm install -g serve
serve -s build
(serve -s build -l 4000)
Getting data
from db.json
and
updating the
UI
Deleting and
Updating
Adding One Student
Fetching Data
UPDATING A STUDENT
Routing
With npm i react-router-dom
VUE.JS
The
Progressive
JavaScript
Framework
Installation
Vue.js is built by design to be incrementally adoptable. This means that it can
be integrated into a project multiple ways depending on the requirements.
• AngularJS renders the program for model view controller (MVC) and model
view-view model (MVVM) architecture, besides the components that are
usually used in dynamic web technologies. It has gained immense
popularity as is the front end portion of MEAN stack, comprising Express.js
app server structural programs that link dynamic MongoDB databases,
Node.js server runtime environment, and Angular.js itself.
Introduction to Angular
• Angular is a framework that is used for developing single-page applications
using TypeScript and HTML programming languages. Angular is generally
denoted as Angular 2+ or Angular v2 and beyond. Angular2 follows core and
optional functionality as a set of TypeScript libraries and utilizes numerous
features of ECMAScript 6 that you may import to your applications. Its
architecture depends on certain crucial scope and conceptions.
• From the varied versions of Angular, the release of Angular 6 had the prime focus
on tool chain, making it function promptly with Angular in ng app update, ng add,
Angular Material + CDK Components, Angular CLI (command line interface)
workspaces, animation and validations package, RxJS v6, and Angular Elements.
• The version of Angular 9 is rationalized to work chiefly with TypeScript 3.6 and 3.7.
It has the ability to move all the applications to employ Ivy compiler view engine and
runtime by default.
FLASK
• It was intended to create a framework that takes less time to develop web
applications. The project implementation stage is very time-consuming, but Django
produces it quickly.
• It includes various helping task modules and libraries which can be used to handle
common Web development tasks. Django takes into account user authentication,
site maps, content administration, and RSS feeds.
• It is a scalable framework and can flexibly and quickly shift from small to large-scale
web application projects.
• Install an official release. This is the best approach for most users.
• Install the latest development version. This option is for enthusiasts who want the
latest-and-greatest features and aren’t afraid of running brand new code. You
might encounter new bugs in the development version, but reporting them helps
the development of Django. Also, releases of third-party packages are less likely
to be compatible with the development version than with the latest stable release.
SOME USEFUL
•
PROJECTS
(Exercice)https://www.youtube.com/watch?v=Z1RJmh_OqeA&ab_channel=freeCodeCa
mp.orgfreeCodeCamp.org
• (Django) https://www.youtube.com/watch?v=ZsJRXS_vrw0&ab_channel=IDGTECHtalk
• (Flask Complete)
https://www.youtube.com/watch?v=9c5U_CKDzOA&ab_channel=ProgrammingKnowled
ge
• (Try
It)https://www.youtube.com/watch?v=yKHJsLUENl0&ab_channel=PythonEngineerPytho
nEngineer
• (Code Basic: Deploy on flask server N#6 and onAmazon EC2 Instance)
https://www.youtube.com/watch?v=rdfbcdP75KI&list=PLeo1K3hjS3uu7clOTtwsp94PcH
bzqpAdg
Flask vs Django: Comparison of
The Best Python Web Frameworks
• Django is termed as a full-stack Python web framework.
Furthermore, it is built based on batteries included. Such a
method in Django makes it simpler for Django developers to
achieve general web development errands like URL routing,
user authentication, and database schema migration.
• With the power of JavaScript frameworks, it became possible to render dynamic content
right from the browser by requesting just the content that was required. The server, in this
scenario, only served the base HTML wrapper that was necessary. This transformation
gave a seamless user experience to visitors since there was very little time taken for
loading the web page. Moreover, once loaded, the web page did not reload itself again.
https://dzone.com/articles/client-side-vs-server-side-rendering-what-to-choos
Server-Side Rendering
Server-side rendering or SSR is the conventional way of rendering web
pages on the browser. As discussed above, the traditional way of
rendering dynamic web content follows the below steps:
• The server checks the resource, compiles and prepares the HTML
content after traversing through server-side scripts lying within the
page.
• This compiled HTML is sent to the client’s browser for further rendering
and display.
• The browser downloads the HTML and makes the site visible to the
end-user
• The browser then downloads the Javascript (JS) and as it executes the
JS, it makes the page interactive
In this process, all the burden of getting the dynamic content,
converting it to HTML, and sending it to the browser is on the server.
Hence, this process is called server-side rendering (SSR).This
responsibility of rendering the complete HTML in advance comes with
a burden on memory and processing power on the server. This
increases the page load time compared to the page load time for a
static site where there is no dynamic content to render.
Client-Side Rendering
Client-side rendering or CSR is a different approach to how the web page is processed for display
in the browser. In the CSR, the burden of compiling dynamic content and generating HTML for
them is transferred to the client's browser.
This approach is powered with JavaScript frameworks and libraries like ReactJS, VueJS, and
Angular. The normal flow of web page rendering for a client-side rendering scenario follows these
steps:
• Instead of a server, a CDN (Content Delivery Network) can be used to serve static HTML, CSS,
and supporting files to the user.
• The browser downloads the HTML and then the JS. Meanwhile, the user sees a loading symbol.
• After the browser fetches the JS, it makes API requests via AJAX to fetch the dynamic content
and processes it to render the final content.
• After the server responds, the final content is rendered using DOM processing in the client's
browser.
In this process, all the burden of getting the dynamic content,
converting it to HTML, and sending it to the browser is on the server.
Hence, this process is called server-side rendering (SSR).This
responsibility of rendering the complete HTML in advance comes with
a burden on memory and processing power on the server. This
increases the page load time compared to the page load time for a
static site where there is no dynamic content to render.
In the following "hello world"
example, many connections
can be handled
concurrently. Upon each
connection, the callback is
fired, but if there is no work
to be done, Node.js will
sleep.
CONTAINERS
Understanding containers
DOCKER