Web Development Illustration

Tue Jan 07 - Written by: Samridha

Web Development Basics

An introduction to web development fundamentals, covering HTTP/HTTPS protocols, REST/GraphQL APIs, web architecture, and cloud-hosted applications.

Web Development Basics

HTTP/HTTPS Protocol

  • Hyper Text Transfer Protocol (HTTP) and HTTP Secure (HTTPS) are protocols used for communication between clients and servers on the web.
  • HTTPS adds an extra layer of security by encrypting communication using SSL (Secure Socket Layer) or TLS (Transport Layer Security).

Request and Response Structure:

  • Request:
    • Contains method, URL, headers, and an optional body.
  • Response:
    • Includes status code, headers, and an optional body.

Common HTTP Methods:

  • GET: Fetch data from the server.
  • POST: Send data to the server to create a resource.
  • PUT: Update an existing resource on the server.
  • DELETE: Remove a resource from the server.

Status Codes:

  • 2xx: Success

    • Example: 200 OK, 201 Created, 204 No Content.
  • 3xx: Redirection

    • Example: 301 Moved Permanently, 302 Found, 304 Not Modified.
  • 4xx: Client Error

    • Example: 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 429 Too Many Requests.
  • 5xx: Server Error

    • Example: 500 Internal Server Error, 502 Bad Gateway, 503 Service Unavailable, 504 Gateway Timeout.

    HTTP Status Codes

    CodeMessageDescription
    200OKRequest was successful and response contains requested data.
    201CreatedNew data was created after a POST request.
    204No ContentRequest was successful, but no content to return (e.g., after a DELETE request).
    301Moved PermanentlyRequested resource has been permanently moved to a different URL.
    302FoundRequested resource has been temporarily moved to a different URL.
    304Not ModifiedResource has not been modified since the last request.
    400Bad RequestThe server could not understand the request due to invalid syntax.
    401UnauthorizedAuthentication is required but was not provided or is invalid.
    403ForbiddenClient understands the request but refuses to authorize it.
    404Not FoundThe requested resource could not be found on the server.
    405Method Not AllowedThe request method is not supported for the requested resource.
    429Too Many RequestsClient has sent too many requests in a short time (rate limiting).
    500Internal Server ErrorThe server encountered an unexpected condition.
    502Bad GatewayThe server received an invalid response from an upstream server.
    503Service UnavailableThe server is temporarily unable to handle requests (e.g., maintenance).
    504Gateway TimeoutThe server did not receive a timely response from an upstream server.

REST and GraphQL APIs

  • REST (Representational State Transfer):
    • A design standard for web APIs that uses HTTP methods like GET, POST, PUT, DELETE.
    • Resources are represented as URLs (e.g., /users).
    • Responses are typically in JSON format.
  • GraphQL:
    • A flexible API query language that allows clients to request specific data in a single query.
    • Ideal for modern applications with complex data requirements.

Web Architecture

Client-Server Model:

  • Client: Sends requests and displays responses.
  • Server: Processes requests and sends back responses.

Single-Page Applications (SPAs):

  • Load a single HTML file and update content dynamically without reloading the page.
  • Examples: Gmail, Trello.
  • Advantages:
    • Reduced server load after the initial page load.
    • Fast and responsive user experience.

Microservices:

  • Applications are divided into small, independent services that perform specific functionalities and communicate via APIs.
  • Advantages:
    • Scalability: Services can scale independently.
    • Fault Isolation: Issues in one service do not affect the others.

Cloud-Hosted Applications:

  • Applications are deployed on cloud platforms like AWS, Azure, or Google Cloud.
  • Advantages:
    • Scalability: Easily scale resources based on demand.
    • Monitoring: Built-in tools for performance monitoring.
    • High Availability: Redundancy and failover capabilities.