• Home
  • Troubleshoot
  • #Example
    • C
    • C++
    • Python
    • R-Programming
  • DSA
  • Quiz
  • Tutorial Videos
  • Home
  • Troubleshoot
  • #Example
    • C
    • C++
    • Python
    • R-Programming
  • DSA
  • Quiz
  • Tutorial Videos
  • #Deals
  • #News
  • #WiKi
  • #APPS
  • #Events
    • #WWDC
    • #I/O
    • #Ignite
  • #Let’s Talk

MyCodeTips mycodetips-newlogocopy1

  • Home
  • Troubleshoot
  • #Example
    • C
    • C++
    • Python
    • R-Programming
  • DSA
  • Quiz
  • Tutorial Videos
Javascript, Programming

How to Install NODE-JS ?

How to Install NODE-JS ?

NODE-JS

Using Website:
You can visit on the link Download Node and download LTS version.
After installing node you can check your node version in command prompt using command..

~ $node --version

After that, you can just create a folder and add a file here for example app.js. To run this file you need to execute command…

first app $node app.js

Node Modules: There are some built-in modules which you can use to create your applications. Some of the popular modules are- OS, fs, events, HTTP, URL and then you can include these modules in your file using these lines.

var fs = require('fs');

Here is an example of how to include HTTP module to build the server…
filter_none
brightness_4

var http = require('http'); 

// Create a server object: 
http.createServer(function (req, res) { 

// Write a response to the client 
res.write('mycodetips'); 

// End the response 
res.end(); 

// The server object listens on port 8080 
}).listen(8080);

This will listen to server on port 8080. Once you will run your file in command prompt it will execute your file and listen to the server on this port. You can also create your own module and include in your file.

Using NPM: NPM is a Node Package Manager provides packages to download and use. It contains all the files and modules that you require in your application. To install any package you need to execute command…

npm install

I am going to show an example of using Events module.

filter_none
brightness_4

var events = require('events'); 
var eventEmitter = new events.EventEmitter(); 

// Create an event handler: 
var myEventHandler = function () { 

console.log('Welcome tomycodetips'); 
} 

// Assign the event handler to an event: 
eventEmitter.on('mycodetips', myEventHandler); 

// Fire the 'mycodetips' event: 
eventEmitter.emit('mycodetips');

So this is how you can start with node and build your own applications. There are some frameworks of the node which you can use to build your applications. Some popular frameworks of node are…Express.js, Socket.io, Koa.js, Meteor.js, Sail.js.

  • Click to share on Reddit (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on Twitter (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)
  • Click to share on Tumblr (Opens in new window)
  • Click to share on Pocket (Opens in new window)
  • Click to share on Pinterest (Opens in new window)
Written by Ranjan - 1026 Views
AUTHOR
Ranjan

I m Ranjan and Sharing my years of experience in Software Development. Love to code in Mobile apps (IOS, Android, Power Apps, Xamarin, Flutter), Machine Learning ( Beginner ), Dot Net, Databases ( SQL Server, MySql, SQLite), WordPress, Cloud Computing ( AWS, Azure, Google, MongoDB) and many more as required on project-specific. Besides this love to travel and cook.

Next Post
Previous Post

Subscribe for updates

Join 6,916 other subscribers

whiteboard

Whiteboard(PRO)

whiteboard

Whiteboard(lite)

alphabets

Kids Alphabet

techlynk

Techlynk

techbyte

Do2Day

techbyte

Techbyte

Latest Posts

  • YT-Featured-Algorithm
    What is Algorithm?
  • Frameworks of IOS
    Frameworks of IOS – Part ( I )
  • NSFileManager or NSPathUtilities
    NSFileManager or NSPathUtilities in Objective-C
  • Passing data between view controllers in Objective-C
    Passing data between view controllers in Objective-C
  • structures-classes-enum
    Structures and Classes in swift !
  • control-system-swift
    Control Flow in Swift
  • swift-concurrency-await
    Concurrency in Swift
  • time-complexity-dsa
    The Term Time Complexity in DSA
  • objective-c-datatypes1
    Objective-C Data Types
  • Convert-jpeg-word
    Convert JPG to Word – Tips You Should Try!

Quick Links

  • #about
  • #myapps
  • #contact
  • #privacy

Other Websites

  • #myQuestions
  • #myBhojanalaya
  • #gadgetFacts
  • #ifscCodesDB

Tag Cloud

Algorithm Android Android Studio API APP Programming Apps blogging Browser Config CSS DATABASE dsa ecommerce error Features Google IO HTML HTML5 IDE installation Interview Questions IOS iPhone javascript Mac objective-c OneDrive OS Placeholder Programming quicktips SDK SEO Settings SMO SQL swift swiftUI Teams Tips & Tricks Tools UI Web Wordpress Xcode

©mycodetips.com