Communication in Web application
This article is to record my learning on some basic knowledge about the Internet, especially how the web apps communication with each other.
I am doing this because I am reviewing my previous projects and find there are some knowledge I can more focus on rather than just many implementations on the code, but of course, coding is important as well.
First there are some nouns about the Internet:
- url : domain address for human to identify
- IP : real IP adress, like everyone knows, like 192.0.0.1
- DNS (Domain Name System): as my understanding is the intepretation between Domain name and IP address, where browser to call .
- protocols : like http, https (the difference I will add a new article to explain, because nowadays, the https is a very important implementation of secure protocol, it is a SSL/TLS protocol to secure the packet)
- domain name : like yahoo.com, google.com
- port : range from 0 to 65535 : In computer networking, a port, also known as a connection port or protocol port, is a service established by software that serves as an endpoint for communication within a computer operating system. Each port is associated with the IP address of the host and a communication protocol. Ports are represented by 16-bit numbers, known as port numbers or simply port numbers.
- packet : a piece of information, usually the info transfer is big, so in order to make the transfer smoother, exchangeable, it is divided in to packet.
Request and Response
Communication between clients and servers involves requests and responses.
The request needs to carry specific info in the following ways, and also is how we implement our APIs).
Query String
?
as a starting point and &
as connection point
ex: /books/1001?name=jeff&id=123&identity=golden
Parameters
The parameters is set the variable included in the path, usually on the endpoint, this is how API usually works.
ex: /dept/A101/members/90310
as /dept/:depNum/members/:memNo
Body
Usually in a form design, we will include the main info in body instead of query string or parameters. As my previous implementation of API, I used the API test tools like Postman and Insomnia to set up the body (and also the header )information to send a request.
Reference:
https://www.cloudflare.com/zh-tw/learning/network-layer/what-is-a-packet
