WebDev General Stuff Flashcards
What does it mean to be RESTFUL?
REST = Representational State Transfer
Set of design principles for making network communication more scalable & flexible.
Constraints that make it restful.
- Network made up of clients and servers (one-to-one communication.
- Uniform Interface: common language between servers and clients that allows each part to be swapped out or modified without breaking the entire system.
What’s an example of non-RESTful alternative to a client-server architecture?
event-based integration architecture.
In this model, each component continuously broadcasts events while listening for pertinent events from other components.
What happens when you type an URL in the browser and press enter?
- The browser checks the cache for a DNS record to find the corresponding IP address of maps.google.com.
- browser cache
- OS cache
- router cache
- ISP cache - If the requested URL is not in the cache, ISP’s DNS server initiates a DNS query to find the IP address of the server that hosts maps.google.com.
- Root domain “.”
- Top-level domain “.com”
- Second-level domain “google” in google.com
- third-level domain “maps” in maps.google.com - Browser initiates a TCP connection with the server.
A. Client machine sends a SYN packet to the server over the internet asking if it is open for new connections.
B. If the server has open ports that can accept and initiate new connections, it’ll respond with an ACKnowledgment of the SYN packet using a SYN/ACK packet.
C. The client will receive the SYN/ACK packet from the server and will acknowledge it by sending an ACK packet.
Then a TCP connection is established for data transmission!
- The browser sends an HTTP request to the web server.
- The server handles the request and assembles back a response.
- The server sends out an HTTP response.
- The browser displays the HTML content (for HTML responses which is the most common).
What is the DOM?
A Web page is a document. This document can be either displayed in the browser window or as the HTML source. But it is the same document in both cases. The Document Object Model (DOM) represents that same document so it can be manipulated. The DOM is an object-oriented representation of the web page, which can be modified with a scripting language such as JavaScript.
What is a Promise?
Promises give us a way to handle asynchronous processing in a more synchronous fashion. They represent a value that we can handle at some point in the future. And, better than callbacks here, Promises give us guarantees about that future value, specifically.
3 States:
- Pending - until a Promise is fulfilled it is in pending state
- Fulfilled - when the first handler is called the Promise is considered fulfilled with the value passed to that handler.
- Rejected - if the second handler is called, the Promise is considered rejected with the value passed to that handler.