Node Js next Go To Technology-Part 1 (Open Doors)

“Accept change else we are irrelevant coming age of technology”

Basic example “Hello World”

use require directive to load http module.

Send the HTTP header ,HTTP Status: 200 : OK with Content Type: text/plain

Now execute the main.js to start the server as follows −

$ node main.js

Verify the Output. Server has started

Server running at http://127.0.0.1:8000/

Module-export

Module encapsulates related code into a single file. When creating a module, this can be interpreted as moving all related functions into a file

First Create App.js

in Following module1.js we use module.exports which then get in app.js using require then we can call “ res.write(module1.myString);” access methods wh

very simple and useful when importing and exporting modules whenever required