Course introduction

Server and client-side

When you write in an URL and hit enter in the address bar of your web browser, a request is sent to a sever where the site is located. The server returns a response to your browser containing the content to be shown by the browser as illustrated in the figure below.

Client requesting a resource from a server, and the server sending a response.
Client requesting a resource from a server, and the server sending a response.

We typically divide the technologies and programming languages involved in web-development based on whether they primarily are being executed on the server or the browser (client). The former is referred to as server-side, and the latter, client-side. Common examples of client-side languages are HTML, CSS, JavaScript, and JavaScript frameworks such as Angular and React, and these are being executed by the browser on your computer. Server-side languages such as PHP are in contrast executed on the server, before a response is sent back to the client, often in HTML format which can be treated by the client browser.

Whereas a JavaScript or HTML-file requested from the server is returned to the client and executed there, server-side code in, for instance, PHP is executed on the server and the result from executing the code is returned as response to the client.
Whereas a JavaScript or HTML-file requested from the server is returned to the client and executed there, server-side code in, for instance, PHP is executed on the server and the result from executing the code is returned as response to the client.

The server typically also communicates with a database server. For instance, PHP code executed on the server can be used to fetch data from a database. When a client request a file from the server, the PHP-code on the server is executed, fetching the data from a database, and the result is returned to the client as seen in the figure below.

Server fetching data from database and returning result to client.
Server fetching data from database and returning result to client.