Web Stack Notes (Unit-1)

Client-Server Components

Client-Server Image

Client: A device or program that makes a request to a server to access resources or services.

Server: A system that provides resources or services to clients based on their requests.

This architecture is fundamental to web applications where the client is typically a web browser and the server is a web server hosting a website or web service.

HTTP Characteristics & Components

HTTP Characteristics Image

HTTP (Hypertext Transfer Protocol): The foundation of data communication on the Web.

Components:

HTTP Request Format

HTTP Request Methods Image

HTTP (Hypertext Transfer Protocol) specifies a collection of request methods to specify what action is to be performed on a particular resource. The most commonly used HTTP request methods are GET, POST, PUT, PATCH, and DELETE. These are equivalent to the CRUD operations (create, read, update, and delete).

Request URL

request-url Image

Uniform Resource Identifier (URI): Identifies the resource on the server.

Cookies

cookies Image

Cookies: Small text files of information created/updated when visiting a website and stored on the user’s web browser.

Cookies are commonly used for information about user sessions, user preferences, and other data on the website. Cookies help websites remember users and track their activities to provide a personalized experience.

Where are cookies stored?

Cookies are stored on a user’s device in the web browser. Depending on the browser and platform, they can be found in different locations. For example, in Windows they are often found in the C:\Users\[username]\AppData\Roaming\[browser name]\Cookies directory.

Types of Cookies:

JSON - Syntax, Arrays, Datatypes

JSON Image

JSON (JavaScript Object Notation): A lightweight format for data exchange.

Syntax:

Data Types:

REST (Representational State Transfer)

REST Image

REST: An architectural style that can be applied to web services to create and enhance properties like performance, scalability, and modifiability.

RESTful web services are generally highly scalable, light, and maintainable, and are used to create APIs for web-based applications. It exposes API from an application in a secure and stateless manner to the client. The protocol for REST is HTTP.

REST emerged as the predominant Web service design model just a couple of years after its launch, measured by the number of Web services that use it.

Advantages of REST:

Search Engine, Web Crawling, SEO

search-engine Image

Search Engine: A software system designed to search for information on the World Wide Web. Examples include Google, Bing, and Yahoo.

Web Crawling:

Web crawlers or spiders are automated scripts that browse the web and index web pages. The crawlers work by visiting a website, downloading its content, and following all the links on the page to find other pages.

SEO (Search Engine Optimization):

SEO involves optimizing web pages to rank higher in search engine results, thus increasing the amount of organic (non-paid) traffic the website receives.

SSL and How it Works

SSL Image

SSL (Secure Sockets Layer): A standard security protocol for establishing encrypted links between a web server and a browser in an online communication.

How SSL Works:

  1. The client sends a request to the server for a secure session.
  2. The server sends its SSL certificate to the client, which contains the server's public key.
  3. The client validates the SSL certificate against trusted authorities.
  4. If the certificate is valid, the client generates a session key, encrypts it with the server's public key, and sends it to the server.
  5. The server decrypts the session key using its private key, establishing a secure session.
  6. All subsequent communication is encrypted with the session key.

SSL is essential for protecting sensitive data, such as credit card numbers, as it is transmitted over the Internet.