Web Servers, Databases, and APIs
Summer Semester 2020
Instructor: Taimur Khan
Source: Taimur Khan.
Source: MDN Docs.
Based on this, a server's role entails:
Source: MDN Docs.
Source: MDN Docs
Real world examples include:
The site you are on right now controls access to content: articles are visible to everyone, but only users who have logged in can edit them. To try this, click on the Edit button at the top of this page — if you are logged in you will be shown the edit view; if you are not logged in you will be taken to the sign-up page.
Source: https://i.stack.imgur.com/E4fYU.jpg
Source: Facebook
Source: Taimur Khan
Source: https://pixabay.com/vectors/database-data-storage-cylinder-149760/
Alternatively referred to as a databank or a datastore, and sometimes abbreviated as a DB, a database is a large quantity of indexed digital information.
The data can be searched, referenced, compared, changed or otherwise manipulated.
Some DB Lingo:
Term | Meaning |
---|---|
Schema | A database contains one or more schemas, which is a collection of one or more tables of data. |
Table (only SQL) | Each table contains multiple columns, which are similar to columns in a spreadsheet. A table can have as little as two columns and as many as 4,096, depending on the type of stored data. |
Collection | A set of records, typically documents, that are grouped together. This is based not on a property within the record set, but within its metadata. Assigning a record to a collection is usually done at creation or update time. |
Index | An ordered list of values present in a particular record. |
Query | A set of criteria that results in a list of records that match the query exactly, returned in order of particular field value(s). |
Source: https://openclassrooms.com/en/courses/5671741-design-the-logical-model-of-your-relational-database/6255746-compare-relational-and-nosql-databases
{
"_id": "USA",
“type”:”country”,
"children": ["TN",”FL]
"parent": null
}
{
"_id": "TN",
“type”:”state”,
"children": ["Nashville”,”Memphis”]
"parent": "USA”
}
{
"_id": "FL",
“type”:”state”,
"children": ["Miami”,”Jacksonville”]
"parent": "USA”
}
{
"_id": "Nashville",
“type”:”city”,
"children": []
"parent": "TN”
}
Schema: _id, type, children, parent
All data between each { } is a document
We will be using MongoDB as a No-SQL database for our project
Source: sourcerer.io/ciaraburkett
API (or Application Programme Interface) "is a computing interface which defines interactions between multiple software intermediaries" - Wikipaedia
Basically this enables server-server communication (but can also be client-(third-party) server comunication)
Transfer data between programmes
There are many types of APIs but in this course we will only talk about REST APIs
Source: sourcerer.io/ciaraburkett
REST stands for Representational State Transfer
It is a set of protocols/standards that describe how communication should take place between the computers and other applications across the network.
It uses simple HTTP methods to communicate between clients and servers. But it should be noted that HTTP and REST are not same.
Websites use (backend) server-side code to:
1) dynamically display different data when needed;
2) generally pulling the data out of a database stored on a server, or from an Application Programme Interface (API);
3) and sending the data to the client (frontend) to be displayed via some code (e.g. HTML and JavaScript).
Source: Taimur Khan's Coggle -- video links from www.codecademy.com.
Server side programming is tough to learn but an invaluable skill