Introduction to Nodejs

A Node.js app is run in a single process, without creating a new thread for every request. Node.js provides a set of asynchronous I/O primitives in its standard library that prevent JavaScript code from blocking and generally, libraries in Node.js are written using non-blocking paradigms, making blocking behavior the exception rather than the norm.


example-of-nodejs


How to install Node.js

Installing Node.js® and NPM is pretty straightforward using the installer package available from the Node.js web site.




Run Node.js scripts from the command line

You can Run your JavaScript File from your Terminal only if you have installed NodeJs runtime. If you have Installed it then Simply open the terminal and type “node FileName.





How to use the Node.js REPL

Starting the REPL is simple - just run node on the command line without a filename. It then drops you into a simple prompt ('>') where you can type any JavaScript command you wish.

node-rep


How to exit from a Node.js program

We can also exit a Node. js REPL by using the command ". exit". When you enter this in a running Node REPL, the current REPL will exit.



Done by Pretty Kunene