TECHNOLOGY 

Published on

KembaraXtra – Computer Science – Web Servers

I. Client-Side vs. Server-Side Technologies

  • Client-Side: Primarily deals with what the user sees and interacts with in the web browser. Uses HTML, CSS, and JavaScript.
  • Server-Side: Deals with the logic and data processing behind the website. Any programming language or technology can be used, as long as it communicates over HTTP and returns data in a format the client understands.

II. Static vs. Dynamic Websites

Feature Static Websites Dynamic Websites
Content HTML, CSS, and JavaScript built ahead of time. HTML generated when a request comes in.
Processing Server returns pre-built files without modification. Server processes the request, often querying a database, generating HTML, and then responding.
Complexity Simpler setup. More complex setup, slower response times, potentially heavy server load, increased security risks.
Response Time Typically faster. Typically slower due to processing.
Server Load Lighter load. Heavier load.
Security Generally more secure. Potentially less secure due to increased complexity.
Example Website developed using only HTML, CSS and JavaScript files and hosted on a web server (Projects #37 through #40). A blog where posts are stored in a database and rendered into HTML when requested.

Important Note: The terms "static" and "dynamic" refer to how the content is generated on the server, not whether the website is interactive or has updated content. User experience (interactivity, content updates) is often handled with JavaScript on the client-side, regardless of whether the site is static or dynamic from the server's perspective.

III. How Static Websites Handle Requests

  1. Browser requests a specific URL.
  2. Web server receives the request.
  3. Web server finds the corresponding static file (e.g., /images/cat.jpg) in its directory.
  4. Web server returns the content of that file to the browser.
  5. The server does not modify the content.

IV. How Dynamic Websites Handle Requests

  1. Browser requests a specific URL.
  2. Web server receives the request and determines that it needs to generate HTML.
  3. The server executes code.
  4. The code queries a database and retrieves the relevant data.
  5. The server formats the data as HTML.
  6. The server responds to the client with the generated HTML.

V. The Trend Toward Static Sites

  • In recent years, there has been a shift back towards static sites where possible.
  • Static sites offer simplicity, speed, and security benefits.

VI. Hosting Static Sites

  • You need a web server software that can serve static files.
  • The software is configured to point to a directory containing the website files.
  • When a request comes in, the server returns the contents of the matching file.

VII. Building Dynamic Websites/Web Services

  • You can use existing software or write custom code to generate dynamic pages.
  • Server-side development offers a wide range of technology choices (programming languages, operating systems, databases, etc.).
  • The client doesn't care what technologies are used on the server-side; it only needs a response in a format it can handle.

VIII. Server-Side Technology Choices

  • Programming Languages: Python, C#, JavaScript (Node.js), Java, Ruby, PHP, etc.
  • Databases: Any type of database can be used.
Picture
0 Comments