Skip to content

Introduction

During this course we mostly focus on client side frameworks as backend development is its own course all together. However we are going to be taking a small sneak peak to serve side as well.

Most large-scale websites use server-side code to dynamically display different data when needed, generally pulled out of a database stored on a server and sent to the client to be displayed via some code (e.g. HTML and JavaScript).

Data Modelling and Backend Development course

The Data Modelling and Backend Development course materials can be found from https://ytsp0200.pages.labranet.jamk.fi/

Server side in general

  • Web browsers communicate with web servers using the HyperText Transfer Protocol (HTTP).
  • When you click a link on a web page, submit a form, or run a search, an HTTP request is sent from your browser to the target server.
  • The request includes a URL identifying the affected resource, a method that defines the required action.
  • Web servers wait for client request messages
  • Response
    • contains a status line indicating whether or not the request succeeded (e.g. "HTTP/1.1 200 OK" for success)
    • The body of a would contain the requested resource (e.g. a new HTML page, or an image, etc...)

Static sites

  • When a user wants to navigate to a page, the browser sends an HTTP "GET" request specifying its URL.
  • The server retrieves the requested document from its file system and returns an HTTP response containing the document and a success status

Simple Server side request

Dynamic sites

  • A dynamic website is one where some of the response content is generated dynamically only when needed.
  • A dynamic site can return different data for a URL based on information provided by the user
  • Most of the code to support a dynamic website must run on the server. Creating this code is known as "server-side programming".

Dynamic sites

Server-side vs. client-side

They have different purposes and concerns.

  • They generally don't use the same programming languages (the exception being JavaScript, which can be used on the server- and client-side).
  • They run inside different operating system environments.
  • Server-side code can be written in any number of programming languages.
  • While both client and server-side code use frameworks, the domains are very different.
  • Web developers can't control what browser every user might be using to view a website.

Server side - what can we do?

  • Efficient storage and delivery of information
    • Server-side programming allows us to store the information in a database and dynamically construct and return HTML and other types of files (e.g. PDFs, images, etc.).
    • It is also possible to simply return data (JSON, XML, etc.) for rendering by appropriate client-side web frameworks
      • This reduces the processing required on the server and the amount of data that needs to be sent
  • Customised user experience
    • Many sites store credit cards so that details don't have to be entered again
    • Sites like Google Maps can use saved or current locations
    • A deeper analysis of user habits can be used to anticipate their interests and further customize responses and notifications (eg. Spotify and Youtube reccomendations)
  • Controlled access to content
    • Restrict access to authorized users and serve only the information that a user is permitted to see
  • Notifications and communication
    • User-specific notifications through the website itself or via email, SMS, instant messaging, video conversations, or other communications services.
  • Store session/state information
    • A mechanism that allows a server to store information on the current user of a site and send different responses based on that information.
  • Data analysis
    • A website may collect a lot of data about users; refine responses based on analysis of this data.