Learn Node JS For JavaScript Day 7


Editor : VS Code
Compiler : Node JS
Package Manager : NPM


VS Code :
  • VS Code is a code editor redefined and optimized for building and debugging modern web and cloud applications.

What is Node.js :
  • Node.js is an open source server environment.

  • Node.js is free.

  • Node.js runs on various platforms (windows, Linux, Unix, Mac OS X, etc).
  • Node.js uses JavaScript on the server.
Why Node.js : 
  • A common task for a web server can be to open a file on the server and return the content to the client.

Here is how PHP or ASP handles a file request:

  1. Sends the task to the computer's file system.
  2. Waits while the file system opens and reads the file.
  3. Returns the content to the client.
  4. Ready to handle the next request.

Here is how Node.js handles a file request:

  1. Sends the task to the computer's file system.
  2. Ready to handle the next request.
  3. When the file system has opened and read the file, the server returns the content to the client.
  • Node.js eliminates the waiting, and simply continues with the next request.

  • Node.js runs single-threaded, non-blocking, asynchronously programming, which is very memory efficient.

What Can Node.js Do?

  • Node.js can generate dynamic page content.
  • Node.js can create, open, read, write, delete, and close files on the server
  • Node.js can collect form data.
  • Node.js can add, delete, modify data in your database. 

What is a Node.js File?
  • Node.js files contain tasks that will be executed on certain events.
  • A typical event is someone trying to access a port on the server.
  • Node.js files must be initiated on the server before having any effect.
  • Node.js files have extension ".js".

Download Node.js :

Example :

Program-
Output-
Getting Started :
  • Once you have downloaded and installed Node.js on your computer.

  • Create a Node.js file named "myfirst.js", and add the following code:

  • The code tells the computer to write "Hello World!"

  • Save the file on your computer: C:\Users\Your Name\myfirst.js.


What is NPM :
  • NPM is a package manager for Node.js packages, or modules.

Comments

Popular posts from this blog

Basic Concept In C Sharp Day 16

Understanding C Sharp Day 18

Learn Garbage Collection Day 21