Explainer | Components of a Server

by allsparkinfinite on 2024-07-27

What Else is in Server Software?

We looked at how server sends static content to the browser, and all the magic related to that is performed in the browser.
But the JavaScript also makes some requests to the server to populate the page, and that contains some server-side magic.

REST API

API stands for Application Programming Interface. It is how Software A can utilize the functionality of Software B. The developers of Software B, after coding all the magic they want it to perform, also implement some interfaces. These interfaces are intended to make it easy for Software A to offload some processing to Software B.

REST stands for REpresentational State Transfer. It is the standard API format for two pieces of software to communicate over the internet. Software B, in this case, would be a server software, called a server for short in this context. Software A could be your browser, but it could also be any other app that just uses APIs from a small set of servers. In this context, Software A is called a client.
Every time the client wants some processing to be done by Software A, it has to send some data (called a request), and wait to receive the processed data (called the response). This whole process is called an API call.

The structures of requests and responses are very similar. They both contain:

The request contains some extra information:

The response also contains a status code, the most common of which is "200 OK" but the most well known is "404 Not Found".

Database

A database is a piece of software which stores data in such a way that reading and writing is very efficient. This data is often limited to text, numbers, and date. Some extra data types are sometimes provided, but they are often simple extensions of the pre-existing data types.
Other complicated types of data (such as files) are stored in bulk storage, with some of their metadata and their location stored in the database for easy lookup.

Most databases are setup to store their files in a dedicated folder, and access to the database is through an API. Some databases just store data in a file and leave the reading and writing up to the software that accesses it.

Relational Databases

These store data in tables, with entries in some columns referring to rows in another table. These relations can get quite messy for complex data storage. Structured Query Language or SQL is a language that is used toaccess data in relational databases.

Key-Value Databases

These store data in "documents", where a document is just a list of labels (known as keys), and some data associated with that label (known as values). A value can be an entire document by itself, creating a structure not unlike folders and files in a computer.