Introduction of Node.js Modules

--

In this tutorial I will give you information about Introduction of Node.js Modules. Node.js modules provide a way to re-use code in your Node.js application. Node.js modules to be the same as JavaScript libraries.

Node.js provide set of built-in modules which you can use without any further installation. like assert, crypto, fs, http, https, path, url etc…

Please check more details or modules on Built-in Module in Node js.

Include Module in Node.js

for include module use the require() function with the name of the module.

var http = require('http');

Now your application has access to the HTTP module, and is able to create a server.

http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end('Websolutionstuff !!');
}).listen(3000);

--

--

Websolutionstuff
Websolutionstuff

Written by Websolutionstuff

I am Laravel and PHP Developer. I have also Good Knowledge of JavaScript, jQuery, Bootstrap and REST API. Visit Website: http://websolutionstuff.com/

No responses yet