What is Callback? Callback is an asynchronous equivalent for a function. A callback function is called at the completion of a given task. Node makes heavy use of callbacks. All the APIs of Node are written in such a way that they support callbacks. For example, a function to read a file may start reading …
Category : Node.js
25 posts
Installing Modules using NPM There is a simple syntax to install any Node.js module − $ npm install <Module Name> For example, following is the command to install a famous Node.js web framework module called express − $ npm install express Now you can use this module in your js file as following − var …
REPL stands for Read Eval Print Loop and it represents a computer environment like a Windows console or Unix/Linux shell where a command is entered and the system responds with an output in an interactive mode. Node.js or Node comes bundled with a REPL environment. It performs the following tasks − Read − Reads user’s input, parses the …
Step 1 – Import Required Module We use the require directive to load the http module and store the returned HTTP instance into an http variable as follows − var http = require("http"); Step 2 – Create Server We use the created http instance and call http.createServer() method to create a server instance and then we bind it at …
Node.js is a server-side platform built on Google Chrome’s JavaScript Engine (V8 Engine). Node.js was developed by Ryan Dahl in 2009 and its latest version is v0.10.36. The definition of Node.js as supplied by its official documentation is as follows − Node.js is a platform built on Chrome’s JavaScript runtime for easily building fast and scalable network applications. Node.js …