Getting Started With Node js
GETTING STARTED WITH NODE JS
Node.js is an open-source, cross-platform runtime environment for developing server-side and networking applications. Node.js applications are written in JavaScript and can be run within the Node.js runtime on OS X, Microsoft Windows, and Linux.
Installing Node:
- Download the required installer:
- Go to https://nodejs.org/en/
- Select the button to download the LTS build that is "Recommended for most users".
- Install Node by double-clicking on the downloaded file and following the installation prompts.
Following are some of the important features that make Node.js the first choice of software architects.
> node -v
Example – Node.js HTTP Server
// include http module in the file var http = require( 'http' ); // create a server listening on 8087 http.createServer( function (req, res) { // write the response and send it to the client res.writeHead(200, { 'Content-Type' : 'text/html' }); res.write( 'Node.js says hello!' ); res.end(); }).listen(8087); |
Once you have created the file, you may run it using node program from the command line interface or terminal.
~$ node node-js-example.js
No comments
If you have any doubts, Please let me know