Looking for a Tutor Near You?

Post Learning Requirement »
x

Choose Country Code

x

Direction

x

Ask a Question

x

x
x
x
Hire a Tutor

Node Js Introduction

Loading...

Published in: Java Script
23,454 Views

This presentation gives and overview of node js, how to install node js and some simple programming examples

Jeevan J / Bangalore

5 years of teaching experience

Qualification:

Teaches: Basic Computer, Computer, English, Mathematics, Science, C / C++, Java And J2EE, Spring Training

Contact this Tutor
  1. Jeevan Jagadeesh
  2. AGENDA D Introduction to Node JS D How to Install Simple Examples NPM
  3. WHAT IS NODE,JS Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine Node.js Uses an event-driven, non-blocking I/O makes it lightweight and efficient el that
  4. WHY NODE, JS Asynchronous and Event Driven - many connections can be handled concurr Lightweight and Very Fast
  5. WHERE ALL NODE.JS I/O bound Applications Data Streaming Applications JSON APIs based Applications Note - It is not advisable to use Node.js for CPU applications. sive
  6. HOW TO INSTALL NODEJS Download latest nodejs.exe from - https://nodejs.org/en/ Execute the exe HOME ABO UT DOWNLOADS DOCS FOUN N GET I NVOLVED SECURITY N EVVS Node.jse is a JavaScript runtirne built on Chrorne's V8 JavaScript engine. Node. js uses an event—driven, non-blocking I/O rmodel that nnakes it lightvveight and efficient. Node.jsT package ecosystern, nprn, is the largest ecosystern of open source libra ries in the vvorld- Dovvnload for VVindovvs (x64) v6.9.5 1-TS Recornrnended For Most Other Dovurnloads I Changelog Users I API Docs v 7.5.0 Cu rrent Latest Features Other Dovvn loads I Changelog I API Docs
  7. VALIDATE NODEJS INSTALLATION Command prompt, node --version C: agadej e>node -version
  8. HELLO WORLD var http = require ('http') ; http.createServer(functian (reg, res console. lag( 'Receving Request') ; res.writeHead (200, res.write( 'Hello World\n') ; res.end(); l) . listen(80B1, ' localhost ' ) , 'text/plain'}) ; console. lag( 'Server running at http://lacalhast:80B1/'),
  9. ASYNC I/O require ( ' fs ' ) , var fs console. time ('Start timer Read') console. time ('Start timer Write') fs.readFi1e ( 'test. txt', function (err, if (err console. log ("File Reading err: data) return; I} console. Reading: + data console . timeEnd ( ' Start fs . writeFi1e ( 'write . txt ' console. lag ("Dane with console .. timeEnd ( ' Start console. log( 'Dane \n') timer 'Writing to file 111 3333' file write In") , timer Write') function ( )
  10. SYNC I/O require var fs ('fs')f console. time ( 'Start timer') ; var data = fs.readFi1eSync( 'test. txt'), Read: + data ansole. timeEnd( 'Start timer') fs. writeFi1eSync ( 'write. txt ' 'Writing to file 111 3333'), with file write") , console. timeEnd( ' Start timer') console. lag( 'Done ;
  11. NODE PACKAGE MANAGER (NPM) Node.js supports modularity. Each modules can be bu under a single package. NPM is used to install, update, uninstall and conf' e ode JS Platform modules/packages very easily.
  12. INSTALLING THIRD PARTY MODULES NPM Install npm install
  13. NODE,JS "REQUIRE" The modules/packages available can be imported in .js file require" funCtiOn. Ex — require( "http"); This helps in loading "http" package in curre
  14. MODULES EXPORT N IMPORT A module in node.js can be exported, by which it can b imported in other files. The "require" function helps in importing modules. Exporting - module.exports{ Importing - V ar = require me > ) ;
  15. REFERENCES https://nodejs.org/en/ htt : www.'ournaldev.com 7462 node-'s-architecture- n le- https://www.npmjs.com
  16. N/A
  17. ????? ???