{"id":632,"date":"2022-05-18T23:09:41","date_gmt":"2022-05-18T23:09:41","guid":{"rendered":"http:\/\/mipython.magwebdesigns.net\/WP\/?p=632"},"modified":"2022-05-20T13:53:41","modified_gmt":"2022-05-20T13:53:41","slug":"node-js-tutorial-http-server","status":"publish","type":"post","link":"http:\/\/mipython.magwebdesigns.net\/WP\/2022\/05\/18\/node-js-tutorial-http-server\/","title":{"rendered":"Node JS Tutorial | HTTP Server"},"content":{"rendered":"\n<p><a href=\"https:\/\/replit.com\/@MANDREWS85\/NodeHTTPServer#index.js\">Node JS Tutorial | HTTP Server REPL HERE<\/a><\/p>\n\n\n\n<p>First lets install Node in our environment.  I&#8217;m using A Debian distro. <\/p>\n\n\n\n<pre class=\"wp-block-code\">\n\n<div class=\"codecolorer-container text blackboard\" style=\"overflow:auto;white-space:nowrap;width:800px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/><\/div><\/td><td><div class=\"text codecolorer\">sudo apt install nodejs<br \/>\nnode -v<br \/>\nsudo apt install npm<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n\n<\/pre>\n\n\n\n<p>Next lets use the HTTP Module <\/p>\n\n\n\n<pre class=\"wp-block-code\">\n\n<div class=\"codecolorer-container text blackboard\" style=\"overflow:auto;white-space:nowrap;width:800px;\"><table cellspacing=\"0\" cellpadding=\"0\"><tbody><tr><td class=\"line-numbers\"><div>1<br \/>2<br \/>3<br \/>4<br \/>5<br \/>6<br \/><\/div><\/td><td><div class=\"text codecolorer\">var http = require('http');<br \/>\nhttp.createServer(function (req, res) {<br \/>\n&nbsp; res.writeHead(200, {'Content-Type': 'text\/html'});<br \/>\n&nbsp; res.write('Hello World!');<br \/>\n&nbsp; res.end();<br \/>\n}).listen(8080);<\/div><\/td><\/tr><\/tbody><\/table><\/div>\n\n<\/pre>\n\n\n\n<p>We now have a running HTTP server.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Well, that&#8217;s it were done.  Super simple HTTP server in Node. We should see a basic HTML page being served with &#8220;HELLO WORLD&#8221; as output.   Check out the next tutorial and we will template an HTML page for our server to serve.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Node JS Tutorial | HTTP Server REPL HERE First lets install Node in our environment. I&#8217;m using A Debian distro. Next lets use the HTTP Module We now have a running HTTP server. Well, that&#8217;s it were done. Super simple HTTP server in Node. We should see a basic HTML page being served with &#8220;HELLO WORLD&#8221; as output. Check out the next tutorial and we will template an HTML page for our server to serve.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-632","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/mipython.magwebdesigns.net\/WP\/wp-json\/wp\/v2\/posts\/632","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/mipython.magwebdesigns.net\/WP\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/mipython.magwebdesigns.net\/WP\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/mipython.magwebdesigns.net\/WP\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/mipython.magwebdesigns.net\/WP\/wp-json\/wp\/v2\/comments?post=632"}],"version-history":[{"count":5,"href":"http:\/\/mipython.magwebdesigns.net\/WP\/wp-json\/wp\/v2\/posts\/632\/revisions"}],"predecessor-version":[{"id":649,"href":"http:\/\/mipython.magwebdesigns.net\/WP\/wp-json\/wp\/v2\/posts\/632\/revisions\/649"}],"wp:attachment":[{"href":"http:\/\/mipython.magwebdesigns.net\/WP\/wp-json\/wp\/v2\/media?parent=632"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/mipython.magwebdesigns.net\/WP\/wp-json\/wp\/v2\/categories?post=632"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/mipython.magwebdesigns.net\/WP\/wp-json\/wp\/v2\/tags?post=632"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}