{"id":96,"date":"2019-09-24T13:40:34","date_gmt":"2019-09-24T13:40:34","guid":{"rendered":"https:\/\/www.kindsonthegenius.com\/nodejs\/?p=96"},"modified":"2019-09-24T13:40:34","modified_gmt":"2019-09-24T13:40:34","slug":"node-js-http-module","status":"publish","type":"post","link":"https:\/\/www.kindsonthegenius.com\/nodejs\/node-js-http-module\/","title":{"rendered":"Node.js &#8211; HTTP Module"},"content":{"rendered":"<p>I think one of the most important modules in Node.js is the http module. This is because it helps you to create both server and client. Then you can transfer data over http(HyperText Transfer Protocol). Essentially, you can with the help of the http module, build a complete client-server web application.<\/p>\n<p>Lets see how it works. We would consider the following 5 areas:<\/p>\n<ol>\n<li><a href=\"#t1\">How Web Servers Work<\/a><\/li>\n<li><a href=\"#t2\">The Architecture of a Web Application<\/a><\/li>\n<li><a href=\"#t3\">Creating a Web Server in Node.js<\/a><\/li>\n<li><a href=\"#t4\">Making a Request to the Server<\/a><\/li>\n<li><a href=\"#t5\">Creating a Web Client in Node.js<\/a><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p><strong id=\"t1\">1. How Web Servers Work<\/strong><\/p>\n<p>A web server is simply a application that handles http requests. This requests come from http client. Http client is another application used to sent requests to the web server. For example, your browser. When a web server receives a http request, then it processes the request and send a http response back to the client. This response is normally a html(web) page. It may also include images, style sheets and scripts.<\/p>\n<p>A web server could process a request either using server side scripting or by an application server.<\/p>\n<p>&nbsp;<\/p>\n<p><strong id=\"t2\">2. The Architecture of a Web Application<\/strong><\/p>\n<p>A complete web application is normally made up of four layers.<\/p>\n<ul class=\"list\">\n<li><b>The Client<\/b> \u2212 This layer consists of internet browsers, or any other applications which can be used to\u00a0 make HTTP requests to the server.<\/li>\n<li><b>Server<\/b> \u2212 This layer contains the Web server which can receive the requests made by the clients and pass them the response.<\/li>\n<li><b>Business Service<\/b> \u2212 This layer contains the application server which is used by the web server to process the request. This layer communicates with the data layer through a database driver or some other programs.<\/li>\n<li><b>Data Store<\/b> \u2212 This layer contains the database or any other source of data used by the web application. For example, MySQL database or MSSQL database.<\/li>\n<\/ul>\n<p>The architecture of a web application is given below:<\/p>\n<figure id=\"attachment_97\" aria-describedby=\"caption-attachment-97\" style=\"width: 533px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/kindsonthegenius.com\/nodejs\/wp-content\/uploads\/sites\/5\/2019\/09\/Web-Application-Architecture.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-97\" src=\"https:\/\/kindsonthegenius.com\/nodejs\/wp-content\/uploads\/sites\/5\/2019\/09\/Web-Application-Architecture.jpg\" alt=\"Web Application Architecture\" width=\"533\" height=\"557\" srcset=\"https:\/\/www.kindsonthegenius.com\/nodejs\/wp-content\/uploads\/sites\/5\/2019\/09\/Web-Application-Architecture.jpg 533w, https:\/\/www.kindsonthegenius.com\/nodejs\/wp-content\/uploads\/sites\/5\/2019\/09\/Web-Application-Architecture-287x300.jpg 287w\" sizes=\"auto, (max-width: 533px) 100vw, 533px\" \/><\/a><figcaption id=\"caption-attachment-97\" class=\"wp-caption-text\">Figure 1: Web Application Architecture<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<p><strong id=\"t3\">3. Creating a Web Server in Node.js<\/strong><\/p>\n<p>You can create a server in Node.js using the createServer method provided by the http module.<\/p>\n<p>Let&#8217;s create\u00a0 a web server that listens at port 8080. The code is given below:<\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #008800; font-weight: bold;\">var<\/span> http <span style=\"color: #333333;\">=<\/span> require(<span style=\"background-color: #fff0f0;\">\"http\"<\/span>);\r\n<span style=\"color: #008800; font-weight: bold;\">var<\/span> fs <span style=\"color: #333333;\">=<\/span> require(<span style=\"background-color: #fff0f0;\">\"fs\"<\/span>);\r\n<span style=\"color: #008800; font-weight: bold;\">var<\/span> url <span style=\"color: #333333;\">=<\/span> require(<span style=\"background-color: #fff0f0;\">\"url\"<\/span>);\r\n\r\n<span style=\"color: #888888;\">\/\/Create a http server<\/span>\r\nhttp.createServer(<span style=\"color: #008800; font-weight: bold;\">function<\/span>(request, response){\r\n    <span style=\"color: #888888;\">\/\/extrate the urlpath from the request<\/span>\r\n    <span style=\"color: #008800; font-weight: bold;\">var<\/span> urlpathname <span style=\"color: #333333;\">=<\/span> url.parse(request.url).pathname;\r\n\r\n    <span style=\"color: #888888;\">\/\/Display the file name coming from th request<\/span>\r\n    console.log(<span style=\"background-color: #fff0f0;\">\"Request from \"<\/span> <span style=\"color: #333333;\">+<\/span> urlpathname);\r\n\r\n    <span style=\"color: #888888;\">\/\/Read the content of the file from the file system<\/span>\r\n    fs.readFile(urlpathname.substr(<span style=\"color: #0000dd; font-weight: bold;\">1<\/span>), <span style=\"color: #008800; font-weight: bold;\">function<\/span>(err, data){\r\n        <span style=\"color: #008800; font-weight: bold;\">if<\/span>(err){\r\n            console.log(<span style=\"background-color: #fff0f0;\">\"Error occured: \"<\/span> <span style=\"color: #333333;\">+<\/span> err);\r\n\r\n            \r\n            <span style=\"color: #888888;\">\/\/Write the http status to the response header<\/span>\r\n            response.writeHead(<span style=\"color: #0000dd; font-weight: bold;\">404<\/span>, {<span style=\"background-color: #fff0f0;\">\"Content-type\"<\/span><span style=\"color: #333333;\">:<\/span> <span style=\"background-color: #fff0f0;\">\"text\/html\"<\/span>});\r\n        }\r\n        <span style=\"color: #008800; font-weight: bold;\">else<\/span> {\r\n            response.writeHead(<span style=\"color: #0000dd; font-weight: bold;\">200<\/span>, {<span style=\"background-color: #fff0f0;\">\"Content-type\"<\/span><span style=\"color: #333333;\">:<\/span> <span style=\"background-color: #fff0f0;\">\"text\/html\"<\/span>})\r\n\r\n            <span style=\"color: #888888;\">\/\/Write the file content to the response body<\/span>\r\n            response.write(data.toString());\r\n        }\r\n        <span style=\"color: #888888;\">\/\/send the response body to the client<\/span>\r\n        response.end();\r\n    });\r\n}).listen(<span style=\"color: #0000dd; font-weight: bold;\">8080<\/span>);\r\n\r\n<span style=\"color: #888888;\">\/\/ Write the message to the console<\/span>\r\nconsole.log(<span style=\"background-color: #fff0f0;\">\"Server is running at port http:\/\/localhost:8080\"<\/span>)\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Next, we would create\u00a0 a simple html page. This page would be placed in the same directory as the server. The content of the page is given below<\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #007700;\">&lt;html&gt;<\/span>\r\n   <span style=\"color: #007700;\">&lt;head&gt;<\/span>\r\n      <span style=\"color: #007700;\">&lt;title&gt;<\/span>Servers in Node.js<span style=\"color: #007700;\">&lt;\/title&gt;<\/span>\r\n   <span style=\"color: #007700;\">&lt;\/head&gt;<\/span>\r\n   \r\n   <span style=\"color: #007700;\">&lt;body&gt;<\/span>\r\n      It works!\r\n\t  The server is runing fine!\r\n   <span style=\"color: #007700;\">&lt;\/body&gt;<\/span>\r\n<span style=\"color: #007700;\">&lt;\/html&gt;<\/span>\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><strong id=\"t4\">4. Making a Request to the Server<\/strong><\/p>\n<p>Now run the program using the command node httpmodule.js<\/p>\n<p>You will see that the server starts up. So open your browser and visit http:\/\/localhost:8080\/index.html. You will see the page we created as shown below.<\/p>\n<p><a href=\"https:\/\/kindsonthegenius.com\/nodejs\/wp-content\/uploads\/sites\/5\/2019\/09\/Node.js-Server-is-runing.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-98\" src=\"https:\/\/kindsonthegenius.com\/nodejs\/wp-content\/uploads\/sites\/5\/2019\/09\/Node.js-Server-is-runing.jpg\" alt=\"\" width=\"589\" height=\"417\" srcset=\"https:\/\/www.kindsonthegenius.com\/nodejs\/wp-content\/uploads\/sites\/5\/2019\/09\/Node.js-Server-is-runing.jpg 752w, https:\/\/www.kindsonthegenius.com\/nodejs\/wp-content\/uploads\/sites\/5\/2019\/09\/Node.js-Server-is-runing-300x212.jpg 300w\" sizes=\"auto, (max-width: 589px) 100vw, 589px\" \/><\/a><\/p>\n<p>If you also look at the console window in VS Code, you will get additional information as shown below<\/p>\n<pre style=\"margin: 0; line-height: 125%;\">PS D:\\Documents\\NodeJSTutorials1&gt; node httpmodule.js\r\nServer is running at port http:\/\/localhost:8080\r\nRequest from \/index.html\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><strong id=\"t5\">5. Creating a Web Client in Node.js<\/strong><\/p>\n<p>Similar to creating a server, we can also create a http client in Node.js. We can do this using the request() method provided by the http module.So let&#8217;s create a file called httpclient.js. The content is as given below:<\/p>\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #888888;\">\/\/ First import the http module<\/span>\r\nhttp <span style=\"color: #333333;\">=<\/span> require(<span style=\"background-color: #fff0f0;\">\"http\"<\/span>);\r\n\r\n<span style=\"color: #888888;\">\/\/ Set the options to be used by the http request<\/span>\r\n<span style=\"color: #008800; font-weight: bold;\">var<\/span> options <span style=\"color: #333333;\">=<\/span> {\r\n    host<span style=\"color: #333333;\">:<\/span> <span style=\"background-color: #fff0f0;\">\"localhost\"<\/span>,\r\n    port<span style=\"color: #333333;\">:<\/span> <span style=\"background-color: #fff0f0;\">\"8080\"<\/span>, \r\n    path<span style=\"color: #333333;\">:<\/span> <span style=\"background-color: #fff0f0;\">\"\/index.html\"<\/span>\r\n};\r\n\r\n<span style=\"color: #888888;\">\/\/Create a callback function that would handle the response<\/span>\r\n<span style=\"color: #008800; font-weight: bold;\">var<\/span> callback <span style=\"color: #333333;\">=<\/span> <span style=\"color: #008800; font-weight: bold;\">function<\/span>(response) {\r\n    <span style=\"color: #008800; font-weight: bold;\">var<\/span> responseBody <span style=\"color: #333333;\">=<\/span> <span style=\"background-color: #fff0f0;\">\"\"<\/span>;\r\n    response.on(<span style=\"background-color: #fff0f0;\">\"data\"<\/span>, <span style=\"color: #008800; font-weight: bold;\">function<\/span>(data){\r\n        responseBody <span style=\"color: #333333;\">=<\/span> responseBody <span style=\"color: #333333;\">+<\/span> data; <span style=\"color: #888888;\">\/\/continuously update the response<\/span>\r\n    });\r\n    response.on(<span style=\"background-color: #fff0f0;\">\"end\"<\/span>, <span style=\"color: #008800; font-weight: bold;\">function<\/span>(){\r\n        <span style=\"color: #888888;\">\/\/ All data received<\/span>\r\n        console.log(responseBody);\r\n    });\r\n}\r\n\r\n<span style=\"color: #888888;\">\/\/Now make the request to the server<\/span>\r\n<span style=\"color: #008800; font-weight: bold;\">var<\/span> request <span style=\"color: #333333;\">=<\/span> http.request(options, callback);\r\nrequest.end();\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Now, open another terminal and run this file (while the server is running). You will see that the body of the html page is displayed.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I think one of the most important modules in Node.js is the http module. This is because it helps you to create both server and &hellip; <\/p>\n","protected":false},"author":1,"featured_media":99,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-96","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Node.js - HTTP Module - Node.js Tutorials<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.kindsonthegenius.com\/nodejs\/node-js-http-module\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Node.js - HTTP Module - Node.js Tutorials\" \/>\n<meta property=\"og:description\" content=\"I think one of the most important modules in Node.js is the http module. This is because it helps you to create both server and &hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.kindsonthegenius.com\/nodejs\/node-js-http-module\/\" \/>\n<meta property=\"og:site_name\" content=\"Node.js Tutorials\" \/>\n<meta property=\"article:published_time\" content=\"2019-09-24T13:40:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.kindsonthegenius.com\/nodejs\/wp-content\/uploads\/sites\/5\/2019\/09\/http-Module-in-node.js-Creating-Server-and-Client.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"879\" \/>\n\t<meta property=\"og:image:height\" content=\"369\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"kindsonthegenius\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"kindsonthegenius\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/node-js-http-module\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/node-js-http-module\\\/\"},\"author\":{\"name\":\"kindsonthegenius\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/#\\\/schema\\\/person\\\/7f8fc5792578d2ff54003fcebe6c46b5\"},\"headline\":\"Node.js &#8211; HTTP Module\",\"datePublished\":\"2019-09-24T13:40:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/node-js-http-module\\\/\"},\"wordCount\":546,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/node-js-http-module\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2019\\\/09\\\/http-Module-in-node.js-Creating-Server-and-Client.jpg\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/node-js-http-module\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/node-js-http-module\\\/\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/node-js-http-module\\\/\",\"name\":\"Node.js - HTTP Module - Node.js Tutorials\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/node-js-http-module\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/node-js-http-module\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2019\\\/09\\\/http-Module-in-node.js-Creating-Server-and-Client.jpg\",\"datePublished\":\"2019-09-24T13:40:34+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/#\\\/schema\\\/person\\\/7f8fc5792578d2ff54003fcebe6c46b5\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/node-js-http-module\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/node-js-http-module\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/node-js-http-module\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2019\\\/09\\\/http-Module-in-node.js-Creating-Server-and-Client.jpg\",\"contentUrl\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/wp-content\\\/uploads\\\/sites\\\/5\\\/2019\\\/09\\\/http-Module-in-node.js-Creating-Server-and-Client.jpg\",\"width\":879,\"height\":369},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/node-js-http-module\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Node.js &#8211; HTTP Module\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/#website\",\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/\",\"name\":\"Node.js Tutorials\",\"description\":\"Best Node.js Tutorials\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/#\\\/schema\\\/person\\\/7f8fc5792578d2ff54003fcebe6c46b5\",\"name\":\"kindsonthegenius\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g\",\"caption\":\"kindsonthegenius\"},\"url\":\"https:\\\/\\\/www.kindsonthegenius.com\\\/nodejs\\\/author\\\/kindsonthegenius-3\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Node.js - HTTP Module - Node.js Tutorials","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.kindsonthegenius.com\/nodejs\/node-js-http-module\/","og_locale":"en_US","og_type":"article","og_title":"Node.js - HTTP Module - Node.js Tutorials","og_description":"I think one of the most important modules in Node.js is the http module. This is because it helps you to create both server and &hellip;","og_url":"https:\/\/www.kindsonthegenius.com\/nodejs\/node-js-http-module\/","og_site_name":"Node.js Tutorials","article_published_time":"2019-09-24T13:40:34+00:00","og_image":[{"width":879,"height":369,"url":"https:\/\/www.kindsonthegenius.com\/nodejs\/wp-content\/uploads\/sites\/5\/2019\/09\/http-Module-in-node.js-Creating-Server-and-Client.jpg","type":"image\/jpeg"}],"author":"kindsonthegenius","twitter_card":"summary_large_image","twitter_misc":{"Written by":"kindsonthegenius","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.kindsonthegenius.com\/nodejs\/node-js-http-module\/#article","isPartOf":{"@id":"https:\/\/www.kindsonthegenius.com\/nodejs\/node-js-http-module\/"},"author":{"name":"kindsonthegenius","@id":"https:\/\/www.kindsonthegenius.com\/nodejs\/#\/schema\/person\/7f8fc5792578d2ff54003fcebe6c46b5"},"headline":"Node.js &#8211; HTTP Module","datePublished":"2019-09-24T13:40:34+00:00","mainEntityOfPage":{"@id":"https:\/\/www.kindsonthegenius.com\/nodejs\/node-js-http-module\/"},"wordCount":546,"commentCount":0,"image":{"@id":"https:\/\/www.kindsonthegenius.com\/nodejs\/node-js-http-module\/#primaryimage"},"thumbnailUrl":"https:\/\/www.kindsonthegenius.com\/nodejs\/wp-content\/uploads\/sites\/5\/2019\/09\/http-Module-in-node.js-Creating-Server-and-Client.jpg","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.kindsonthegenius.com\/nodejs\/node-js-http-module\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.kindsonthegenius.com\/nodejs\/node-js-http-module\/","url":"https:\/\/www.kindsonthegenius.com\/nodejs\/node-js-http-module\/","name":"Node.js - HTTP Module - Node.js Tutorials","isPartOf":{"@id":"https:\/\/www.kindsonthegenius.com\/nodejs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.kindsonthegenius.com\/nodejs\/node-js-http-module\/#primaryimage"},"image":{"@id":"https:\/\/www.kindsonthegenius.com\/nodejs\/node-js-http-module\/#primaryimage"},"thumbnailUrl":"https:\/\/www.kindsonthegenius.com\/nodejs\/wp-content\/uploads\/sites\/5\/2019\/09\/http-Module-in-node.js-Creating-Server-and-Client.jpg","datePublished":"2019-09-24T13:40:34+00:00","author":{"@id":"https:\/\/www.kindsonthegenius.com\/nodejs\/#\/schema\/person\/7f8fc5792578d2ff54003fcebe6c46b5"},"breadcrumb":{"@id":"https:\/\/www.kindsonthegenius.com\/nodejs\/node-js-http-module\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.kindsonthegenius.com\/nodejs\/node-js-http-module\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.kindsonthegenius.com\/nodejs\/node-js-http-module\/#primaryimage","url":"https:\/\/www.kindsonthegenius.com\/nodejs\/wp-content\/uploads\/sites\/5\/2019\/09\/http-Module-in-node.js-Creating-Server-and-Client.jpg","contentUrl":"https:\/\/www.kindsonthegenius.com\/nodejs\/wp-content\/uploads\/sites\/5\/2019\/09\/http-Module-in-node.js-Creating-Server-and-Client.jpg","width":879,"height":369},{"@type":"BreadcrumbList","@id":"https:\/\/www.kindsonthegenius.com\/nodejs\/node-js-http-module\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.kindsonthegenius.com\/nodejs\/"},{"@type":"ListItem","position":2,"name":"Node.js &#8211; HTTP Module"}]},{"@type":"WebSite","@id":"https:\/\/www.kindsonthegenius.com\/nodejs\/#website","url":"https:\/\/www.kindsonthegenius.com\/nodejs\/","name":"Node.js Tutorials","description":"Best Node.js Tutorials","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.kindsonthegenius.com\/nodejs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.kindsonthegenius.com\/nodejs\/#\/schema\/person\/7f8fc5792578d2ff54003fcebe6c46b5","name":"kindsonthegenius","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b9d710de456c3d85e5614c3a6992fa3d527425e2ab32b8bd5d85bfbaa235004b?s=96&d=mm&r=g","caption":"kindsonthegenius"},"url":"https:\/\/www.kindsonthegenius.com\/nodejs\/author\/kindsonthegenius-3\/"}]}},"_links":{"self":[{"href":"https:\/\/www.kindsonthegenius.com\/nodejs\/wp-json\/wp\/v2\/posts\/96","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kindsonthegenius.com\/nodejs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kindsonthegenius.com\/nodejs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/nodejs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/nodejs\/wp-json\/wp\/v2\/comments?post=96"}],"version-history":[{"count":1,"href":"https:\/\/www.kindsonthegenius.com\/nodejs\/wp-json\/wp\/v2\/posts\/96\/revisions"}],"predecessor-version":[{"id":100,"href":"https:\/\/www.kindsonthegenius.com\/nodejs\/wp-json\/wp\/v2\/posts\/96\/revisions\/100"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/nodejs\/wp-json\/wp\/v2\/media\/99"}],"wp:attachment":[{"href":"https:\/\/www.kindsonthegenius.com\/nodejs\/wp-json\/wp\/v2\/media?parent=96"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/nodejs\/wp-json\/wp\/v2\/categories?post=96"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kindsonthegenius.com\/nodejs\/wp-json\/wp\/v2\/tags?post=96"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}