{"id":19926,"date":"2018-01-09T16:15:57","date_gmt":"2018-01-09T14:15:57","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=19926"},"modified":"2018-01-08T12:07:14","modified_gmt":"2018-01-08T10:07:14","slug":"node-js-hello-world-example","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/","title":{"rendered":"Node.js Hello World Example"},"content":{"rendered":"<p>In this post, we take a look at one of the most exciting development in recent times. Node.js, the framework or platform that has gained favour with thousands of developers world wide. It has everybody excited with all the new possibilities it opens up. Suddenly front end developers found that they could use most of their existing skills with JavaScript to write server side code. We take a look at how to get started with Node.js with a customary Hello World Example.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n[ulp id=&#8217;7Yp6ijpjjxyeaN8A&#8217;]<\/p>\n<h2>1. Tools &amp; Technologies<\/h2>\n<p>I used the following tools &amp; technologies for working with this project. You can switch out some of the tools in case you are comfortable with others available out there.<\/p>\n<ol>\n<li><a href=\"https:\/\/nodejs.org\" target=\"_blank\" rel=\"noopener\">Node.js<\/a><\/li>\n<li><a href=\"https:\/\/www.npmjs.com\/package\/express\" target=\"_blank\" rel=\"noopener\">Express<\/a><\/li>\n<li><a href=\"https:\/\/code.visualstudio.com\/download\" target=\"_blank\" rel=\"noopener\">Visual Studio Code IDE<\/a><\/li>\n<\/ol>\n<p>On the <code>Node.js<\/code> Website you should see two versions listed. One of them an LTS one and a Current. You should install the LTS version as it is recommended for most users. The LTS version at the time of writing this was <code>v8.9.4<\/code>. Once you download and install Node, you can go to the command line and run the following commands to make sure things are setup properly.<\/p>\n<pre class=\"brush: bash;\">&gt; node -v\r\n<\/pre>\n<p>This should return the version of Node installed if everything went well.<\/p>\n<pre class=\"brush: bash;\">&gt; v8.9.4\r\n<\/pre>\n<p>The download in addition to installing Node will install npm and to check for it you can run the following command.<\/p>\n<pre class=\"brush: bash;\">&gt; npm -v\r\n<\/pre>\n<p>This will return the version of npm like below:<\/p>\n<pre class=\"brush: bash;\">&gt; v5.6.0\r\n<\/pre>\n<p>Later in the article, we will take a look at what is npm and what purpose it serves.<\/p>\n<h2>2. Project Layout<\/h2>\n<p>We will create our project using <code>npm<\/code> step by step. Firstly, we create a folder for our project. Then we navigate to it using command line window and run the following command.<\/p>\n<pre class=\"brush: bash;\">&gt; npm init\r\n<\/pre>\n<p>This will lead to a series of simple questions asked of us before creating our <code>package.json<\/code> file. But do not worry since the questions are pretty basic. I list the questions and the suggested answers below.<\/p>\n<table>\n<thead>\n<tr>\n<th>Question<\/th>\n<th>Suggested Answers<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>name<\/td>\n<td>You can provide the name of the project, lower caps &amp; single string. For ex:<br \/>\nwcg_nodejs_hello_world<\/td>\n<\/tr>\n<tr>\n<td>version(1.0.0)<\/td>\n<td>Just press Enter key to accept the default or provide a specific one<\/td>\n<\/tr>\n<tr>\n<td>description<\/td>\n<td>A brief description of your project. I will just enter the title of the article, as WCG &#8212; Node.js Hello World Example<\/td>\n<\/tr>\n<tr>\n<td>entry point(index.js)<\/td>\n<td>Leave this setting to default. We will discuss more regarding this in the article ahead.<\/td>\n<\/tr>\n<tr>\n<td>test command<\/td>\n<td>A command to run test cases. Leave it blank for now.<\/td>\n<\/tr>\n<tr>\n<td>git repository<\/td>\n<td>URL of the git repository hosting the source code. Leave it blank for now.<\/td>\n<\/tr>\n<tr>\n<td>keywords<\/td>\n<td>keywords related to the project and its purpose go here. I have added Node.js and WCG<\/td>\n<\/tr>\n<tr>\n<td>author<\/td>\n<td>The author of the project. You can enter your name here I have entered mine.<\/td>\n<\/tr>\n<tr>\n<td>license(ISC)<\/td>\n<td>License terms for use of the code. Accept the default for now, i.e., ISC.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Confirm the input which will create a <code>package.json<\/code> file in the project directory. The contents of the file look like below:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>package.json<\/em><\/span><\/p>\n<pre class=\"brush: js;\">{\r\n  \"name\": \"wcg_nodejs_hello_world\",\r\n  \"version\": \"1.0.0\",\r\n  \"description\": \"WCG -- Node.js Hello World Example\",\r\n  \"main\": \"index.js\",\r\n  \"scripts\": {\r\n    \"test\": \"echo \\\"Error: no test specified\\\" &amp;&amp; exit 1\"\r\n  },\r\n  \"keywords\": [\r\n    \"Node.js\",\r\n    \"WCG\"\r\n  ],\r\n  \"author\": \"Siddharth Seth\",\r\n  \"license\": \"ISC\"\r\n}\r\n<\/pre>\n<h2>3. What is npm?<\/h2>\n<p><code>npm<\/code> stands for Node Package Manager and provides access to the entire ecosystem of package libraries for different uses. This command line tool helps us manage the project dependencies and versioning for them. We will see it in action in the section below which describes using Express package for creating a Web Server.<\/p>\n<h2>4. Handling Web Requests<\/h2>\n<p>Now to write our first application we create a file named <code>index.js<\/code> at the root of the project. We chose this name since, if you remember, we provided the name as the entry point of our application after we ran <code>npm init<\/code>. In this file we write the following code to create a basic web server which handles web requests and returns the string &#8220;Hello World&#8221;.<\/p>\n<pre class=\"brush: js;\">var http = require(\"http\");\r\nvar port = 8090;\r\nvar host = \"127.0.0.1\";\r\nhttp.createServer(function(request, response){\r\n    response.write(\"Hello World!\");\r\n    response.end();\r\n}).listen(port, host);\r\n<\/pre>\n<p>This is all it takes, to spin up a web server in Node.js. But, I think, a little bit of explanation is in order. So in the first line of code, we require the <code>http<\/code> module of node. Think of it as an <code>import<\/code> or <code>include<\/code> statement in other server side languages. Now that we have the <code>http<\/code> module available we call its <code>createServer<\/code> method and pass a callback function to it. We also chain the call to the <code>listen<\/code> method passing it a port and hostname. The callback function takes two arguments, namely, <code>request<\/code> and <code>response<\/code> and is called every time our URL is hit. The request argument wraps all the details about the incoming web request and we can control the output that is sent out through the response object. In our code, we simply return the string &#8220;Hello World!&#8221; and then close the response stream. Remember to call the <code>end<\/code> method though as otherwise our application would get hung up and be unavailable to process subsequent requests. The output of the above code looks like below when we run it using the command <code>node index.js<\/code> and navigate to the URL <code>http:\/\/localhost:8090<\/code><\/p>\n<figure id=\"attachment_20040\" aria-describedby=\"caption-attachment-20040\" style=\"width: 554px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/01\/ProjectOutputNodejsArticle.jpg\"><img decoding=\"async\" class=\"size-full wp-image-20040\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/01\/ProjectOutputNodejsArticle.jpg\" alt=\"\" width=\"554\" height=\"462\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/01\/ProjectOutputNodejsArticle.jpg 554w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/01\/ProjectOutputNodejsArticle-300x250.jpg 300w\" sizes=\"(max-width: 554px) 100vw, 554px\" \/><\/a><figcaption id=\"caption-attachment-20040\" class=\"wp-caption-text\">Project Output<\/figcaption><\/figure>\n<h2>5. Using Express<\/h2>\n<p>In previous sections I referred to <code>npm<\/code>, the Node Package Manager. It is a tool to pull in other packages built on top of Node.js that provide readymade functionality. It helps us build up applications quickly without having to reinvent the wheel so to speak. There are literally thousand of packages available out there developed by fellow developers that we can use as building blocks for our applications. NPM fits in as a tool that allows us to manage these dependencies and their versioning. As an example, in this article we will pull up the popular Express module which helps us build a server side API with a host of features without obscuring the Node.js features. To use the Express framework in our application, we need to pull it down using the following command.<\/p>\n<pre class=\"brush: bash;\">&gt; npm install --save express\r\n<\/pre>\n<p>This command with its <code>save<\/code> switch will pull down Express module with all its dependencies as well as save the dependency information in the <code>package.json<\/code> file. The downloaded dependencies go into a folder named <code>node_modules<\/code>. Now our <code>package.json<\/code> file looks as follows:<\/p>\n<p><span style=\"text-decoration: underline;\"><em>package.json<\/em><\/span><\/p>\n<pre class=\"brush: js;\">{\r\n  \"name\": \"wcg_nodejs_hello_world\",\r\n  \"version\": \"1.0.0\",\r\n  \"description\": \"WCG -- Node.js Hello World Example\",\r\n  \"main\": \"index.js\",\r\n  \"scripts\": {\r\n    \"test\": \"echo \\\"Error: no test specified\\\" &amp;&amp; exit 1\"\r\n  },\r\n  \"keywords\": [\r\n    \"Node.js\",\r\n    \"WCG\"\r\n  ],\r\n  \"author\": \"Siddharth Seth\",\r\n  \"license\": \"ISC\",\r\n  \"dependencies\": {\r\n    \"express\": \"^4.16.2\"\r\n  }\r\n}\r\n<\/pre>\n<p>Let us create a new JavaScript file to test out the express module. We will call it <code>api.js<\/code> and add the following code to the file.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>api.js<\/em><\/span><\/p>\n<pre class=\"brush: js;\">var express = require(\"express\");\r\nvar port = 8090;\r\nvar host = \"127.0.0.1\";\r\nvar app = express();\r\n\r\napp.get(\"\/api\/:name\", function(req, res){\r\n    res.send(\"Hello \" + req.params.name);\r\n});\r\n\r\napp.listen(port, host);\r\n<\/pre>\n<p>As you can see from the code we require the express module and create an instance of the same. We the wrote code to accept <code>HTTP GET<\/code> requests for the URL <code>http:\/\/localhost:8090\/api\/:name<\/code>. In case you are wondering what the <code>:name<\/code> does is it names the command line arguments passed in by the user as part of the URL, for example, <code>http:\/\/localhost:8090\/api\/Siddharth<\/code>. This argument is then made available through request object params property. We use it to return a greeting to the passed in name through the response object send method. To see all of this in action we can execute the command <code>node api.js<\/code> and navigate to the URL <code>http:\/\/localhost:8090\/api\/<em>your name<\/em><\/code>. The response should look like below:<\/p>\n<figure id=\"attachment_20053\" aria-describedby=\"caption-attachment-20053\" style=\"width: 709px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/01\/ScreenShotExpressModule.jpg\"><img decoding=\"async\" class=\"size-full wp-image-20053\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/01\/ScreenShotExpressModule.jpg\" alt=\"\" width=\"709\" height=\"459\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/01\/ScreenShotExpressModule.jpg 709w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/01\/ScreenShotExpressModule-300x194.jpg 300w\" sizes=\"(max-width: 709px) 100vw, 709px\" \/><\/a><figcaption id=\"caption-attachment-20053\" class=\"wp-caption-text\">Screenshot Express Module<\/figcaption><\/figure>\n<h2>6. Running the Application<\/h2>\n<p>To run our application, we need to navigate to the root of the project in a command line window and execute the following command:<\/p>\n<pre class=\"brush: bash;\">&gt; npm install\r\n<\/pre>\n<p>To test out the http module web server, you need to execute the following command:<\/p>\n<pre class=\"brush: bash;\">&gt; node index.js\r\n<\/pre>\n<p>To test the Express web server, you need to execute the following command:<\/p>\n<pre class=\"brush: bash;\">&gt; node api.js\r\n<\/pre>\n<h2>7. Download the Source Code<\/h2>\n<p>This wraps up this introduction to the Node.js platform.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here : <a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2018\/01\/WCG-Node.js-Hello-World-Example.zip\"><strong>WCG &#8212; Node.js Hello World Example<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this post, we take a look at one of the most exciting development in recent times. Node.js, the framework or platform that has gained favour with thousands of developers world wide. It has everybody excited with all the new possibilities it opens up. Suddenly front end developers found that they could use most of &hellip;<\/p>\n","protected":false},"author":213,"featured_media":924,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[347],"class_list":["post-19926","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-node-js","tag-nodejs"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Node.js Hello World Example - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"In this post, we take a look at one of the most exciting development in recent times. Node.js, the framework or platform that has gained favour with\" \/>\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.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Node.js Hello World Example - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"In this post, we take a look at one of the most exciting development in recent times. Node.js, the framework or platform that has gained favour with\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2018-01-09T14:15:57+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Siddharth Seth\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Siddharth Seth\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/\"},\"author\":{\"name\":\"Siddharth Seth\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/9c939eb4c915443c7e493c813d979592\"},\"headline\":\"Node.js Hello World Example\",\"datePublished\":\"2018-01-09T14:15:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/\"},\"wordCount\":1239,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg\",\"keywords\":[\"nodejs\"],\"articleSection\":[\"Node.js\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/\",\"name\":\"Node.js Hello World Example - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg\",\"datePublished\":\"2018-01-09T14:15:57+00:00\",\"description\":\"In this post, we take a look at one of the most exciting development in recent times. Node.js, the framework or platform that has gained favour with\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Node.js\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/node-js\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Node.js Hello World Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/9c939eb4c915443c7e493c813d979592\",\"name\":\"Siddharth Seth\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g\",\"caption\":\"Siddharth Seth\"},\"description\":\"Siddharth is a Software Development Professional with a Master degree in Computer Applications from IGNOU. He has over 14 years of experience. And currently focused on Software Architecture, Cloud Computing, JavaScript Frameworks for Client and Server, Business Intelligence.\",\"sameAs\":[\"https:\/\/www.webcodegeeks.com\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/siddharth-seth\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Node.js Hello World Example - Web Code Geeks - 2026","description":"In this post, we take a look at one of the most exciting development in recent times. Node.js, the framework or platform that has gained favour with","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.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/","og_locale":"en_US","og_type":"article","og_title":"Node.js Hello World Example - Web Code Geeks - 2026","og_description":"In this post, we take a look at one of the most exciting development in recent times. Node.js, the framework or platform that has gained favour with","og_url":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_published_time":"2018-01-09T14:15:57+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg","type":"image\/jpeg"}],"author":"Siddharth Seth","twitter_card":"summary_large_image","twitter_creator":"@webcodegeeks","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Siddharth Seth","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/"},"author":{"name":"Siddharth Seth","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/9c939eb4c915443c7e493c813d979592"},"headline":"Node.js Hello World Example","datePublished":"2018-01-09T14:15:57+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/"},"wordCount":1239,"commentCount":2,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg","keywords":["nodejs"],"articleSection":["Node.js"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/","url":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/","name":"Node.js Hello World Example - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg","datePublished":"2018-01-09T14:15:57+00:00","description":"In this post, we take a look at one of the most exciting development in recent times. Node.js, the framework or platform that has gained favour with","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/nodejs-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/javascript\/node-js\/node-js-hello-world-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/"},{"@type":"ListItem","position":3,"name":"Node.js","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/node-js\/"},{"@type":"ListItem","position":4,"name":"Node.js Hello World Example"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/9c939eb4c915443c7e493c813d979592","name":"Siddharth Seth","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/86a5133a5e9d79f7997e2649b1afe58e895c0d88df47b3359103ec4c1a2077d6?s=96&d=mm&r=g","caption":"Siddharth Seth"},"description":"Siddharth is a Software Development Professional with a Master degree in Computer Applications from IGNOU. He has over 14 years of experience. And currently focused on Software Architecture, Cloud Computing, JavaScript Frameworks for Client and Server, Business Intelligence.","sameAs":["https:\/\/www.webcodegeeks.com"],"url":"https:\/\/www.webcodegeeks.com\/author\/siddharth-seth\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/19926","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/213"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=19926"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/19926\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/924"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=19926"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=19926"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=19926"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}