Node.js-Introduction

Key Points – Node.JS

  • Open Source
  • Cross Platform
  • Javascript Runtime Environment
  • Execute in Server Side
  • Runs on V8 Engine
  • Written in (JS) + (C++)

Version History

Why Node.JS Special?

Let’s get Idea of Why we use Node.JS

Javascript Everywhere

Allowing web application development to unify around a single programming language, rather than rely on a different language for writing server side scripts

Server Side JS

Javascript used primarily for client-side scripting, Node.js enables JavaScript to be used for server-side scripting

Key Features

Threading

Node.js operates on a single thread, using non-blocking I/O calls, allowing it to support tens of thousands of concurrent connections without incurring the cost of thread context switching.

V8

V8 is the JavaScript execution engine built for Google Chrome and open-sourced by Google in 2008. Written in C++, V8 compiles JavaScript source code to native machine code instead of interpreting it in real time.

Package management

npm is the pre-installed package manager for the Node.js server platform. It is used to install Node.js programs from the npm registry, organizing the installation and management of third-party Node.js programs.

 

Unified API

Node.js can be combined with a browser, a database supporting JSON data. With the adaptation of what were essentially server-side development patterns such as MVC, MVP, MVVM, etc

Event loop

Node.js registers itself with the operating system in order to be notified when a connection is made, and the operating system will issue a callback.

 

Who Uses Node.JS?

PHP Way & Node.JS Way

What Node.JS Can 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

Getting Started !

var http = require(‘http’);

http.createServer(function (req, res) {
    res.writeHead(200, {‘Content-Type’: ‘text/html’});
    res.end(‘Hello World!’);
}).listen(8080);

Type This Code and Save it As myfirst.js in Known Location,

Then Open Command Line Tool and Navigate to the Location that we saved our js File.

D:/first>node myfirst.js

Check node version and npm version

Open Note pad and make Hello world application and Run . 

Run on server 8080

Get a JSON output from node application

Get a XML output from node application

Make a node functions

Create external html file

Read external file from nodejs

Node module install using rpm

Testing with server-Upper case letter

Node.JS Folder structure 

Module structure

Mysql install

Connect to Mysql data base and retrieve data as JSON format

Android Tutorials
admin

ප්‍රතික්ෂේපිත අයදුම්කරුවන්ගේ සංශෝධිත ලේඛනය – රැකියා විරහිත උපාධිධාරීන් / ඩිප්ලෝමාධාරීන් රැකියාගත කිරීමේ වැඩසටහන 2020

ගම්පහ / Gampaha / கம்பஹா  https://drive.google.com/file/d/1UyvRkhKj3Jd-irunRtlSxvAQbJzUE_jm/view?fbclid=IwAR3I_i1XFqs5X7pXBvwxZAq1R7t3za0yEZX05qGj7QdbKTUSWG4zUaCiFJw මන්නාරම / Mannar / மன்னார் https://drive.google.com/file/d/1J_JcXMz8wH8bU2JjV9NxUyl8GOxCHVlG/view?fbclid=IwAR39R9w-NtO41HloHbfBM5zwJcJwugWQGABpZSVcWJ_6XvYLIUbf7KMigcA මුලතිව් / Mulathivu / முல்லைத்தீவு https://drive.google.com/file/d/1cwzt9MGck6ntl2HiVvsYRsOgf4w6PUGM/view?fbclid=IwAR0PsVO0gKGKOafJ-5Js-AmXmF-qWQ5DFd8-V0GJbY2FN74VV6AS6LYXFUI කුරුණෑගල / Kurunegala / குருணாகலை https://drive.google.com/file/d/1xcdUDYKiuWMWINVnKTzVM-JiS8ahQcEP/view?fbclid=IwAR3ZoAI55eYlqEHjykKuT2BqqBzLs-nQs8NARM4J0ifzRZIs4KtcxSxRoPA පොළොන්නරුව

7,690 total views, 16 views today

Read More »
Android Tutorials
admin

Jobs Recruitment Program for Unemployed Graduates 2020-SriLanka

Last Updated. 2020/08/17 7.00AM Anuradhapura DistrictSelected List Galenbindunuwewa : https://drive.google.com/file/d/1JtrTMqAPya2XeDm-soDiFyZIxfKLXsRf/view?usp=sharing Galnewa : https://drive.google.com/file/d/1WEgBVGG5-GgUQRgsQFaiIVgHO01HtmLE/view?usp=sharing Horowpothana : https://drive.google.com/file/d/1q0b9tAS91xiBiyn1ugXlYr3yMAKseaqh/view?usp=sharing Ipalogama : https://drive.google.com/file/d/1pVckCM82Dl_2mNSiFtFBSu5vb9LGSQpq/view?usp=sharing Kahatagasdigiliya : https://drive.google.com/file/d/1JOT2-TSUiEPIYFKcUzxkvU0pxLoWsnx5/view?usp=sharing Kebithigollewa : https://drive.google.com/file/d/1CC2IhHqAl-jLpB5U9RgCLfnjgqc00Tmv/view?usp=sharing

33,787 total views, 40 views today

Read More »
Android Tutorials
admin

Healthlylifeus

www.healthlylifeus.com Share on facebook Facebook Share on google Google+ Share on twitter Twitter Share on linkedin LinkedIn  5/5 10,700 total views, 16 views today

10,700 total views, 16 views today

Read More »
Android Tutorials
admin

Apple keyboard shortcuts for business users

Apple keyboard 20 shortcuts for business users Command + Tab (Apple keyboard 20 shortcuts for business users) This key combination will allow you to cycle

10,478 total views, 16 views today

Read More »

5 Comments

  1. Do you have any type of ideas for writing short articles?

    That’s where I constantly battle and also I just wind up looking empty screen for
    very long time.

1 Trackback / Pingback

  1. Google

Leave a Reply

Your email address will not be published.


*