HTTP stands for Hyper Text Protocol
It is one of the most powerful protocol. HTTP is not the only protocol uses URLs.
Protocol is a set of rules, and two computers can follow this instructions. It also tells how to parse this information as something useful.
It is also referred as scheme. Some examples of URL protocols:
- https
- http
- ftp
- mailto
Not all schemes require "//" as it is only included for authority component.
The client is known as the requesting computer which asks another computer for some information.
Meanwhile the server is known as the computer which sends the info back to the client that it requested.
Prefix in URLs are used to tell which request to use
const response = await fetch(url, settings)
const responseData = await response.json()
url
is the URL of requestsettings
contains config in as an object
await
is needed to pause the code, and wait for that response to come back as we are sending bits of data, sometimes almost across the world.
IPv4: Address separated by periods, and each section is in the range of 0-255. Four numbers, each number is one byte of information. Every device connected to the internet has its own unique IP address. Eg: 8.13.156.7
IPv6: Newer format, way more possible than IPv4 because running out of IPv4 address, separated by colon and has six sections
In order to connect to a server, its unique IP address needs to be known.
Map human readable to IP addresses. Computers first resolve the DNS before connecting.
For example, in the URL https://github.com/vlang
has a hostname of github.com
, and rest ain't part of the DNS mapping.
It is a unique character sequence that identifies a resource that can be accessed via the internet.
It comes in two types:
- URLs (locator)
- URNs (name)
Note: URLs are only one kind of URI.
http://testuser:[email protected]:8080/testpath?testsearch=testvalue#testhash
protocol: http:
username: testuser
password: testpass
hostname: testdomain.com
port: 8080
pathname: /testpath
search: ?testsearch=testvalue
hash: #testhash
hash is used to link a section of a website and search is a map
An HTTP header allows clients and servers to pass additional information with each request or response. They are always case-insensitive key-value pairs
that pass additional metadata
about the request or response
where metadata is what headers are typically used for, is like data for data.