Node.js First ExampleLast Updated : 17 Mar 2025 There can be console-based and web-based node.js applications. Node.js console-based ExampleFile: console_example1.js Open Node.js command prompt and run the following code: ![]() Here, console.log() function displays message on console. Node.js web-based ExampleA node.js web application contains the following three parts:
How to create node.js web applications Follow these steps: File: main.js
How to start your server: Go to start menu and click on the Node.js command prompt. ![]() Now command prompt is open: ![]() Set path: Here we have save "main.js" file on the desktop. So type cd desktop on the command prompt. After that execute the main.js to start the server as follows: ![]() Now server is started. Make a request to Node.js server: Open http://127.0.0.1:8081/ in any browser. You will see the following result. ![]() Now, if you make any changes in the "main.js" file, you need to again run the "node main.js" command. Next TopicNode.js Console |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India




