{"id":555,"date":"2019-03-05T23:31:20","date_gmt":"2019-03-06T07:31:20","guid":{"rendered":"https:\/\/doubleecpu.com\/?page_id=555"},"modified":"2019-06-26T00:27:35","modified_gmt":"2019-06-26T07:27:35","slug":"nodejssimple","status":"publish","type":"page","link":"https:\/\/doubleecpu.com\/index.php\/raspian-linux-programs\/javascript-2\/nodejssimple\/","title":{"rendered":"Nodejs Simple Website"},"content":{"rendered":"\n<p>If Needed install Nodejs and npm by running the command <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo apt-get install nodejs npm<\/pre>\n\n\n\n<p>Installation of each can be verified by typing<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">node -v<br>npm -v<\/pre>\n\n\n\n<p>Node installation can also be tested by typing <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">node<br>&gt;3+1<br>4<\/pre>\n\n\n\n<p>Install the npm package called http-server. The http-server package was created by the amazing IndexZero (aka Charlie Robbins). Navigate to directory<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo npm install -g http-server\n\n<\/pre>\n\n\n\n<p>Change the directory to the \/home\/pi\/Public directory to store and serve up public web files. Create file index.html and and insert test html.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cd \/home\/pi\/Public<br>sudo touch index.html<br>sudo nano index.html<br><br>&lt;html&gt;<br>&lt;head&gt;<br>  &lt;title&gt;Welcome&lt;\/title&gt;<br>&lt;\/head&gt;<br>&lt;body&gt;<br>  Welcome to my website!<br>&lt;\/body&gt;<br>&lt;\/html&gt;<br><\/pre>\n\n\n\n<p>Save and close index.html, verify the file exist in the directory then launch http-server<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ls<br>#Verify that the file exists<br> index.html<br>#Start Nodejs Web Server<br>http-server<br><br>Starting up http-server, serving .\/<br> Available on:<br>   http:\/\/127.0.0.1:8080<br>   http:\/\/192.168.0.230:8080<br> Hit CTRL-C to stop the server<\/pre>\n\n\n\n<p>open webrowser and enter the IP address or http:\/\/localhost:8080 which should open website displaying &#8220;Welcome to my website!&#8221;  <\/p>\n\n\n\n<p>On a different computer on the same network the same webpage should be accessible by typing the http:\/\/[IP address]:8080 or http:\/\/[hostname]:8080<br><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If Needed install Nodejs and npm by running the command sudo apt-get install nodejs npm Installation of each can be verified by typing node -vnpm -v Node installation can also be tested by typing node&gt;3+14 Install the npm package called http-server. The http-server package was created by the amazing IndexZero (aka Charlie Robbins). Navigate to &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/doubleecpu.com\/index.php\/raspian-linux-programs\/javascript-2\/nodejssimple\/\" class=\"more-link\">Read more<span class=\"screen-reader-text\"> &#8220;Nodejs Simple Website&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":582,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-555","page","type-page","status-publish","hentry"],"featured_media_urls":[],"_links":{"self":[{"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/pages\/555","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/comments?post=555"}],"version-history":[{"count":0,"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/pages\/555\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/pages\/582"}],"wp:attachment":[{"href":"https:\/\/doubleecpu.com\/index.php\/wp-json\/wp\/v2\/media?parent=555"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}