A. JavaScript Object Notation Basic Functions
JSON.parse() - Use to convert strings into JSON Objects.
const users = '{"name": "aryan", "age": 21, "height": 6.3}'
const users_parse = JSON.parse(users)
JSON.stringify() - Used to convert JSON Object to string.
const user2 = {
name : "ARYAN",
gender : "MALE",
}
console.log(user2)
const user2string = JSON.stringify(user2)
console.log(user2string)
B. What is HTTP Server?
- Hyper text transfer protocol.
- Used by machines to communicate to each other.
- Also used by the frontend to talk to the backend.
- The
s in HTTPS means secure.
- Protocol -
http / https
- Address -
(URL, IP, Port) : chat.openai.com
- Route -
/backend-api/conversations
- Headers - Key & Value pairs automatically sent by browser or client. Used for Auth, etc.
- Body - Contains the data sent by the user.
- Query - Filters and parameters in the URL, placed after the
?.
C. Firing a Request!
- Browser parses the URL.
- It then does a DNS lookup → when we go to www.google.com, we are indirectly looking for a DNS.