AngularJS Introduction

Node.js Introduction

Node.js is an asynchronous event driven cross-platform JavaScript runtime. It is built on Google's Chrome V8 JavaScript engine. Node.js is mainly using single thread for creating highly scalable web servers.

Note: It is not JavaScript framework.

Want to dive deeply?

Installing Node.js on Windows

  1. Download NodeJS from official site.
  2. It is very simple to install just follow the prompts. By default it will be installed in C:\Program Files\nodejs
  3. Restart the computer for setting the window's PATH environment variable for C:\Program Files\nodejs\bin

Testing the NodeJS

Open Run Window by pressing Windows Key + R, type "node" and press Enter for open command window.

Type below code and press enter.
console.log(5 + 3);
Output
8
undefined
for Close command window type
exit

Hurray !!! Node.js installed successfully. Now proceed to http-server npm

What is npm?

NPM (Node Package Manager) is command line program (installed automatically with Node.js runtime) used to installed the third party JavaScript package or module (directory with one or more files mentioned in package.json). There are thousands of libraries have been built for Node.js and are hosted on npm websites.

http-server Introduction

It is command line tool for running http-server. Mainly it is used for testing and debugging web apps in local machines.

How to install http-server?

Open Node.js command window and enter the command
npm install http-server -g
It will http-server install globally for running any web app from command line.

How to run web app running via http-server?

Open command window, go to your web app project folder (example D:\MyApp).
D:
cd MyApp
http-server
Now you can visit http://localhost:8080 to view your server

Creating windows batch file (.bat) for running web app from Desktop.

Type these commands in notepad and save "MyApp.bat" batch file on desktop.
@echo off
D:
cd D:\MyApp
http-server
Now just double-click on batch file to run the http-server