When a request is received, we are asking our function to return a “Hello World” response to the client.This function is called, whenever a request is made to our server application. In this 2 nd line of code, we are creating a server application which is based on a simple function. So in our case, since we want to use the functionality of HTTP and we are using the require(http) command. Using this object, one can then use the various functionalities available in the module called by the require function. The basic functionality of the “require” function is that it reads a JavaScript file, executes the file, and then proceeds to return an object.Once you have Node.js download and installed on your computer, let’s try to display “Hello World” in a web browser.Ĭreate file Node.js with file name firstprogram.js var http = require('http') Note: If you get an error like “C:\ProgramData\chocolatey\lib\libreoffice\tools\chocolateyInstall.ps1” Then manually create the folder in the path Running your first Hello World application in Node.js If the installation is successful, you will get the message of the successful installation of Node.js. This can be done by running the below command in the command prompt. Step 2) The next step is to install Node.js to your local machine using the Chocolatey, package manager.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |