lkpthree.blogg.se

Hello world in javascript on mac
Hello world in javascript on mac








hello world in javascript on mac

If you observe above code, we are importing http module by using require directive and created the server to listen a request and response on port number 4200. Importing http core package/module provided by nodejs Now create a new folder wherever you want in your system, and in that create a file called Helloworld.js and write the code like as shown below. We need to create a server to listen a client requests similar to Apache or IIS server.īy using these we can read the client requests and we can return our application response. The following are the three main components required in node.js to create a web application.īy using require directive we can import required modules in the application. After we type a message and click on Enter, it returned the string whatever we mentioned in a terminal. If you observe the above result, we tried to print a message in node.js shell by typing the message “ Hello World”. Generally, when we install a node.js in our machine, we will get a Node.js command-line interface and other required components.Īfter opening Node.js command-line interface, type console.log(“Hello World”) command in the console and click on the enter button that will show the output like as shown below. To open a node.js command-line interface, search for node.js in windows and click on Node.js desktop app like as shown below. Node.js Hello World Console Applicationīy using node.js command-line interface, we can create console applications.

hello world in javascript on mac

Here, we will learn both ways to create node.js simple hello world application with examples. In node.js, we can create either console or web applications based on our requirements. Now, we will learn how to create simple node.js hello world application in different ways using node.js command-line interface. In previous node.js chapters, we learned what is node.js? and how to setup node.js development environment.










Hello world in javascript on mac