Node.js used to compelling server side languages such as PHP, .NET and Ruby into a single compelling package.
Node.js used in many famous industrial packages such as backbeam, Yahoo, ebay and Linkedin.
Install and Test Node.js on Windows
Step 1: Download Nodejs for Windows from official website.
If you install Node.js in Windows, just install software like other windows applications.
Step 2: Test your Node.js application
Open any code editor or notepad. Type console.log(‘Application Working’);. Save this file with .js extension (Example: test.js).
Step 3: Open Windows Command Prompt using start -> All Programs -> Accessories -> Command Prompt
Change your command line directory as Desktop using cd Desktop command.
Type node test.js (In this tutorial i am named my file as test.js) and press enter button. Its show Application
working (which added inside console.log(”).
Now it confirm your node,js is running in Windows. If you need Linux based Environment for Node.js in Windows use Cygin.
var os = require("os"); var msg = 'Your System running under '+ os.platform() +' OS.'; console.log(msg);
The first one is the require function.
var os = require("os");
When you use a require statement, node searches for what’s called a module. In this case we specify to load os module. Require function return the object which represents all of code available in os module.
Save this example script as os.js file.
Now open your Command Prompt and change the directory to desktop.
Type node os.js
This script pull information from operating system and display in command line.
Try different operating system based utility functions in nodejs.