HTTP request method is made up of four components:
Request Method ==> Get, Post, Put, Delete (these are
the common ones)
Request URL ==> the URL of the resource
Request Header ==> Accept-Language, AcceptEncoding, User-Agent, Host
Request Body ==> This is the data to be sent to the
resource
Request Query Parameters : key value pair
HTTP response method is made up of three components:
Response Status Code ==> 200, 301, 404, 500
(these are the most common ones)
Response Header Fields ==> Date, Server, LastModified, Content-Type
Response Body ==> This is the data that comes
back to the client from the server.
GET /library/
Host: www.cloudacademy.com
Scheme: https
User-Agent: Chrome Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-GB,en;q=0.5
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
JScopieddoneconst https = require('https')const options = { hostname: 'example.com', port: 443, path: '/todos', method: 'GET'}
const req = https.request(options, res => { console.log(`statusCode: ${res.statusCode}`)
res.on('data', d => { process.stdout.write(d) })})
req.on('error', error => { console.error(error)})
req.end()